I can't find anything related on this online so I'm just asking here.
✓ ANSWER ACCEPTED
How do I put a cooldown on a ClickDetector?
2 answers
✓ Accepted answer
I made a quick script showing you how it works!
local debounce = false -- debounce is a var you can make to do cooldowns ect.
local click = script.Parent.ClickDetector
click.MouseClick:Connect(function(player) -- fires once the click detector has been activated
if debounce == false then -- check if debounce isn't on the cooldown.
debounce = true -- if debounce isn't on cooldown, it will fire and set debounce to true making it so you can't click it again.
wait(3) -- waits 3 seconds, you can change this to what time you want
debounce = false -- after the wait() finished, it will set debounce to false allowing you to activate the click detector again.
end
end)
local cooldown = false
local click = [[your click detector place here]]
click.MouseClick:Connect(function()
if not cooldown then
cooldown = true
[[your scripts here]]
wait(2) -- change 2 to how many seconds you want
cooldown = false
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
why do you even need to put player after function