Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is my dropper script creating two drops instead of one?

https://prnt.sc/1qcvxu8 Dropper script

https://prnt.sc/1qcw1rp Purchase script

I am pretty inexperienced in programming and wanted to create a really basic tycoon and had this as my dropper script. When you purchase the dropper, it moves the dropper from server storage to the "objects" model (in the tycoon) and there is an if statement checking if the model's parent is the objects model. Sometimes it works when I test it and sometimes it drops in bursts of two. (By sometimes it works and sometimes it doesn't, I mean sometimes when I test it, it always drops one and other times it will always double drop, not just sometimes it will drop two and other times it will drop one)

I tried a lot of fixes and ended up with this code since I thought the problem could be that the loop is being started more than once, so I made only one loop that runs continuously, but the bug still happens.

Also sorry if my code is messy

2 comments

0

Do some debugging, see if anything runs twice. It happens all the time with me, its usually a loop or a debounce with the wrong requirements

0

I tested by putting a print in the loop and found out that sometimes when I test it, it only prints once before stopping (probably because the dropper starts in workspace and is moved into server storage) but sometimes it just loops forever anyways and when I buy the dropper, it creates another loop... I still have no clue why this happens and why it happens seemingly randomly

1 answer

I tried moving all of the droppers to server storage, to begin with, instead of having a loop that runs at the start and moves all of them to server storage and the bug was resolved. I still don't have any idea why it was happening or how this fixed it, but I guess my question is answered

This discussion is preserved as it was. New answers, comments, and votes are closed.