Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Buying upgrades doesn’t work.
- CallumSch
-
New Scratcher
17 posts
Buying upgrades doesn’t work.
In my game each button to upgrade your factory is stored as one sprite with multiple costumes. The code that I have detects if costume = 1 then switch costume to upgrade 1. But for some reason when you buy the upgrade instead of switching to the next upgrade it just buys them all.
https://scratch.mit.edu/projects/906546626
https://scratch.mit.edu/projects/906546626
- BladiPetrov
-
Scratcher
100+ posts
Buying upgrades doesn’t work.
I see it ok? It just goes to the next one. IDK what you mean
- ticoeteco23gb
-
Scratcher
100+ posts
Buying upgrades doesn’t work.
The problem is that the code checks all instantly, so when you click to buy, it also upgrades in the same time. Try changing the code into this:

It limits itself to just one upgrade, and it won't go to the next until you buy again. I play tested with this modification and worked fine.

It limits itself to just one upgrade, and it won't go to the next until you buy again. I play tested with this modification and worked fine.
Last edited by ticoeteco23gb (Oct. 14, 2023 19:07:07)
- Discussion Forums
- » Help with Scripts
-
» Buying upgrades doesn’t work.


