Coin Collecting has Cooldown

Heya! I’m dev

I recently came across this issue while making an egg hunting system including currency and collectables. When collecting currency it has a cooldown before you can collect another coin.

The way this works is that I get all eggs under the Eggs folder in workspace, on touch I fire a client remote blah blah blah, and here’s where the tricky part comes where I think the issue occurs;

I receive the remote, apply the UI effect

Then tween and add a couple of task.wait(s) in between, which is probably the cause for the debounce/cooldown, but I have no idea how to approach a workaround…

I’m able to attach small code snippets if needed.

1 Like

wait() pauses the the next events for the time you’ve mentioned,
try using delay.

Examples:

wait(3)
print('hi')
print('bye')

Output: waits 3 seconds, then sends hi and bye

delay(3, function() print('hi') end)
print('bye')

Output: prints bye first then waits 3 seconds then prints hi
This means delay only pauses the function that is inside the delay function itself, not like wait that pauses the whole functions below its lines.

2 Likes