Clone loop causes clones to spontanousely spawn for an infinite amount of time

this script has a problem where clones keep spawning and will spawn so much that it makes very laggy. I have no idea why. when the green flag is pressed or anything is edited, the star sprite starts creating clones with no end. maybe it’s this piece of code instead of the one above

but it just doesn’t make sense due to the fact the set number of clones is set, like 3. One thing that could impact the reason why it does this is since one of the variables, cancel_script, controlls if its being used for which type of game is being played. maybe a error comes from the variable switching up? i don’t know. i just want to know why it constantly loops when nothing shows that it would be doing this.

You should probably put this in Help with Snap! > Snap! Editor.


Can you share the project where this problem is happening?

since we don’t have the full project, this is just a guess, but it could be because your game0 broadcast is getting received by not just the main sprite, but all the clones as well, meaning the clones are creating more clones, then those clones create more, and so on. you can add a check to the broadcast using <not (my [temporary? V])>