Discuss Scratch

Purpleowlelliot
New to Scratch
24 posts

Clones not deleting

Hi, so my project has a sprite where it creates clones of itself, and when it receives a broadcast, it's supposed to delete. For some reason it won't delete.
deck26
Scratcher
1000+ posts

Clones not deleting

So share the project please so we don't have to guess.
Cool_Dude2022
Scratcher
100+ posts

Clones not deleting

Purpleowlelliot wrote:

Hi, so my project has a sprite where it creates clones of itself, and when it receives a broadcast, it's supposed to delete. For some reason it won't delete.

I'm pretty sure you cannot delete a clone via a broadcast message. The code won't work if it looks something like this:

when I receive [Message v]
delete this clone

I would suggest setting a variable to delete the clone, something like this should work:

when I start as a clone
forever
if <(Delete Clone?) = [True]> then
delete this clone
end
end

Did I help you fix your problem? If so, please nominate my project to be featured!

If my code is used, credit is NOT required
Anhkv
Scratcher
15 posts

Clones not deleting

Purpleowlelliot wrote:

Hi, so my project has a sprite where it creates clones of itself, and when it receives a broadcast, it's supposed to delete. For some reason it won't delete.
Use This:
when I start as a clone
set [Delete Clone v] to [Yes]
when green flag clicked
forever
if <(Delete Clone) = [Yes]> then
Delete Clone




else

end
end
define Delete Clone
delete this clone
Let me know if this was useful.
mumu245
Scratcher
1000+ posts

Clones not deleting

Cool_Dude2022 wrote:

(#3)

Purpleowlelliot wrote:

Hi, so my project has a sprite where it creates clones of itself, and when it receives a broadcast, it's supposed to delete. For some reason it won't delete.

I'm pretty sure you cannot delete a clone via a broadcast message. The code won't work if it looks something like this:

when I receive [Message v]
delete this clone

I would suggest setting a variable to delete the clone, something like this should work:

when I start as a clone
forever
if <(Delete Clone?) = [True]> then
delete this clone
end
end
Yes you can delete clones from a broadcast. I just tried it.

select this text then press Ctrl+Shift+Down to read more
mumu245
Scratcher
1000+ posts

Clones not deleting

Please, post the part of the code that is behaving weirdly so we can help you.

select this text then press Ctrl+Shift+Down to read more
Purpleowlelliot
New to Scratch
24 posts

Clones not deleting

For some reason even when i bring out the delete this clone block and press it it does not delete.
Here is the link: https://scratch.mit.edu/projects/961161093/ It was working before, i don't know why it isn't now. If you find an error in my code, please tell me.

Powered by DjangoBB