How do I correctly use While events

How do I create a while event? I’m trying to make a clicker game and in that game I want a CPS where you get score every second. I figured that a while event would be the way to go but it just crashes the game every time I try to buy the upgrade. I would like help to see what is the right way to have a while event. P.s. I use the automated while event found in the add tab at the bottom right of your code.

  • your regard
    Joseph

Please share a screenshot of your event sheet.

Going off limited info I’m gonna make a guess… more info would be useful as Arthuro suggested though…

I think you need to set a variable to stop the CPS running just before you are buying an upgrade…

On the while event for CPS you could add a condition
Value of variable PauseCPS = 0

Then on the upgrade event add an action
Change value of variable PauseCPS = 1

Now your CPS should only run when you set the PauseCPS back to 0, after buying upgrade…

while events need to have a determined end, and way to get out of the while loop.
If not, the while event will repeat itself on that very frame and will not move to the next, until it finishes its task.