Make cooldown system for tool?

I’m a beginner scripter and would like to know this. Let’s say I have a tool that does something everytime you click it, but there’s a 3 second cooldown on it to prevent spam. How would I do that?

Always have a look in the wiki, or use the Search bar up top first:

1 Like

People would usually use debounces to handle cooldowns.
Here’s the documentation on it:

An example with a tool cooldown would be something like this (debounce):

local tool = script.Parent
local debounce = false

tool.Activated:Connect(function()
    if not debounce then
        debounce = true
        -- Do your actions
        wait(3) 
        debounce = false
    end
end)
1 Like