Spawning not working

Okay, so the logic is when you “buy/click a penguin” it subtracts the cost and spawns ONE penguin, but the problem is, it subtracts the greatest amount it can and spawns multiple penguins according to the cost, like normally, a basic penguin is 100 gold, and when I have 300 and I click to buy it, it subtracts 300 and spawns 3 basic penguins, so…,???
link:https://flowlab.io/game/play/2177723

1 Like

image
You just set up a loop

2 Likes

Is it the switch making it infinite, cause I added that to try and not make it infinite


I would just do this