Hello! I am new to scripting, and I was wondering how I can add a cooldown to this tool. It's not complete, it's supposed to make the player switch between their civillian costume and superhero costume, as well as giving their powers. So I don't really want it to be spammed. Thank you!
script.Parent.Equipped:Connect(function(Mouse)
Mouse.Button1Down:Connect(function()
local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
script.Parent.Handle.Sparkles.Enabled = true
wait (1)
animation:Play()
wait (2)
script.Parent.Handle.Sparkles.Enabled = false
end)
end)

1 comment
try using an a Tool.Activated event instead of a combination of mouse.Button1Down and Tool.Equipped