Hey, How would I put a cooldown on a button, like, force the player to wait 10 seconds before the function of the button works again?
Thanks!
This method in general is usually called a debounce.
The basic idea is that you keep track of some state of whether or not its enabled.
Whenever the event happens (like pressing the button) you mark it as disabled. After the time is up, you re-enable it.
That will end up looking something like this:
coolingDown = false function event() if not coolingDown then -- Do whatever else -- Do whatever else -- coolingDown = true wait(10) coolingDown = false end end -- calls / connections to `event`
At the very end of your script before the run command make a wait(10) command and insert any number you want in the parenthesis.