local bool = false
local cooldown = false
local cooldown_Number = 5 -- How many seconds to turn off cooldown.
if bool == false then
if cooldown == false then
bool = true
print("on")
cooldown = true
task.wait(cooldown_Number)
cooldown = false
end
elseif bool == true then
if cooldown = false then
bool = false
print("off")
cooldown = true
task.wait(cooldown_Number)
cooldown = false
end
end
I am not good answering to people but this might help you.
local cooldown = false
local function activate()
if cooldown then return end
cooldown = true
if not bool then
print("on")
else
print("Off")
end
bool = not bool
task.wait(2)
cooldown = false
end
activate() -- call this
NOTE: this only works if this is on the client, if it’s on the server you’ll need to create a cooldown for each player individually, let me know if you need that!