Help broadcast is somehow messing up code?

So when I click on this code, it removes the last clone of my sprite, which as u can see should happen 3 times with a 0.5 second delay each time. When I click on the block, it works exactly as intended; however, if I make that block run with a broadcast, then instead of only deleting 3 of the 20 clones on screen, it deletes all of them in 3 stages. Can anyone tell me what is wrong? Thanks in advance

Hi! Welcome to the forum.

The clones share the code in your sprite's scripting area. So when you broadcast the message, every clone starts deleting clones.

Bruh.

Whaa thats rude?I didnt know.
Classical exponential error.

I suggest that broad casts should only work on clones if they ackknolegde the user about cloning problems.

There's no need to be rude- they probably didn't know.

Well, but, that would break a bunch of projects. Instead, you can use the new feature that lets you direct a broadcast to a particular sprite.

Thank you for the replies, but which block would this be and how would I use this? Sorry for being so clueless, I have java experience but I'm new here and experience between the 2 languages doesn't exactly translate that well

You can check if the spite is a clone and allow execution only for the parent sprite
untitled script pic - 2022-10-15T023847.692

The block I meant is the same BROADCAST block, but if you click on the little arrowhead at the right end, it'll look like this:
untitled script pic
and then you can use the second input to direct the message to a specific sprite.

https://snap.berkeley.edu/snap/snap.html#present:Username=227721&ProjectName=Sticks

so that's the project I'm working on and its incomplete at the moment, but basically its a player and a computer removing 1 to 3 sticks at a time, and whoever removes the very last stick loses. For some reason though, when it broadcasts to a specific clone to delete it, it somehow ends up deleting 2 clones instead. Could you please take a look at my code and tell me if anything is wrong? The sprite with my problems is called "Line maker"

Ok thank you so much

Nevermind I figured it out. Thanks all!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.