I made a button that has a cooldown, but everytime it is clicked during cooldown, it just starts the whole cooldown over again. Any ways to combat this?
function OnClicked()
wait(1)
script.Parent.BrickColor = BrickColor.new("Really red")
script.Parent.Running.Value = false
wait(60)--starts wait over again.
script.Parent.BrickColor = BrickColor.new("Lime green")
script.Parent.Running.Value = true
end
script.Parent.ClickDetector.MouseClick:connect(OnClicked)--everytime the button is clicked it starts wait over again.

4 comments
What does the debounce do?
debounce makes sure it only triggers once and if it has already triggered it waits till its finish then resets it self.
that is very good to know
If you want to know a bit more about it: https://scriptinghelpers.org/glossary/Debounce