Money score system

How can I make a proper money coins system with the score being able to spend coins/score on an item and subtracting the score by the price but if not enough the transaction does not go through or doesn’t allow it

My project: https://makecode.com/_92j69pPUDU2D

I’d like to offer my help by just giving a breakdown of how the logic should flow on this, to give you something better to go off of.

We need variables for the players money (you can also just use score), and we also need a variable for the price of the thing (unless it’s a one time purchase, in which case a set value would work fine, but if its like an upgrade then you’ll probably want to increase the price).

For the logic:

When the player tries to buy something, first check: is their money/score variable greater than or equal to the price of the upgrade? if it is, then they have enough money for the upgrade, and you should 1. give them the upgrade/effect. 2. decrease their money/score by the cost value/variable, and 3. increase the cost variable (if you want).

otherwise, they didn’t have enough money, so just give a message telling them that and don’t do anything else.