I can gave you a kind of idea , I am not very good in C2.
I think you can check the condition of buy and not with Boolean variable. So if the condition if 0 it is buy and you can change the image that the object is buy else 1 is a condition in which a player can purchase the item. Something like this. Hope this idea helps you.
We have a lot more experienced members and you will get some help for sure after some time.