(SOLVED) Scratch bug heads up: Identical code but didn't delete clones

I noticed using the browser extension “Scratch Addons” it showed multiple clones being created (it’s a feature in it to show how many clones exist). Being able to drag them confirmed their existence. I downloaded the file from the resources tab and it runs perfectly as expected with only a single clone present at a time and when I drug it in the game/preview window there wasn’t a duplicate underneath. After comparing the code I verified it was identical, and I know it isn’t due to the addons extension because the downloaded file worked perfectly.

I even went so far as to make sure the broadcast and variables were spelled/capitalized/spaced the exact same way and even the movement code order to be identical (I realize it shouldn’t make a difference, but when debugging, even the unlikely things should be tested). For completely unknown reasons it is NOT deleting the clones. The EXACT same code.


SOLUTION:

After creating two new sprites to test it, it worked fine. Deciding to delete/recreate the code one piece at a time I found that after deleting both of the “When I receive…” from the gift, recreated them, and re-attached the “delete this clone” and “create clone of (myself)” blocks it works fine.

I’m assuming this is some kind of bug in Scratch. I can’t imagine what could actually cause it. I had similar issues with the race car lesson placing flowers on the track despite identical code (I accidentally loaded the course file over my project wiping it out so can’t test this solution on it)

Anyway, I figured I’d post this here so any future students who run into this or similar problems can hopefully save themselves the hour and a half of debugging headaches I just went through. Just try deleting the header for the script and re-placing/attaching. Worked for me at least.

(note simply detaching/reattaching isn’t enough. You have to DELETE the original block and add it new.)

Edit: Just to add to the confusion, I loaded the copy which was still bugged and flipped the create/delete clone to the other “when I receive” header and it worked fine. I put them back to their original and the bug returned… Still, deleting/remaking them seems to be the answer. The order they are created in may matter however.

Privacy & Terms