All my clones suddenly disappear

Your program is running fine, occasionally creating a clone, and then suddenly after about 15 of them are made, they all disappear.

The problem is that you're creating many more clones than you think you are, exponentially many, and when you reach Snap!'s limit of 5000 clones, they disappear.

You have a script that looks something like this:
untitled script pic
What you're forgetting is that once you have some clones, the clones run this script too, not just the original sprite. So, the first time the event happens, the script makes one clone. But the second time, the original sprite makes a clone, and the first clone makes a clone too, so there are two new clones, plus the existing two copies, for a total of four. The third time, each of the four sprites makes a clone, so there are eight.

Clones created by scripts (as opposed to ones you make by choosing "Clone" from the sprite's context menu) share the same position, direction, costume, etc. with their parents, so you can't see them unless you explicitly move them away from their parent (or somehow move only the parent). This is why your bug isn't obvious.

After the event script has been triggered 12 times, you have 212=4096 copies of the original sprite, namely the original and 4095 clones. The 13th time the event happens, you pass the limit of 5000 clones, and Snap! deletes them all.

The solution is to make sure that only the parent sprite runs the code that creates a clone:
untitled script pic (1)
or
untitled script pic (2)