Hello, I am basically trying to make a system so if you hold something for a certain amount of seconds, it awards you something. But you can also hold onto it so you can keep getting it without re clicking.
The code for what I'm trying to achieve is below:
while hold == true do wait(WaitTime) if hold == true then sendEvent(part) else break end end
I'm basically using rays to detect the click of a part, and InputEnded to make hold = false, but I found an issue that if you re-click it within the WaitTime seconds, everything will be duplicated and it will run again, because when you click it again, the InputBegan event is firing again.
If anyone knows how I can fix this, please let me know!