✓ Accepted answer
For that, you should use debounce! It's quite a simple concept firstly you want to create a variable call it debounce or cooldown anything really! And make the variable false. I'm not too sure about what you are asking, if you are trying to achieve a cooldown on your equip/unequip or just animation from what I understand you are asking for animation so here are the building blocks.
local cooldown = false
local cooldownTime = 5
script.Parent.Equipped:Connect(function(Mouse)
Mouse.Button1Down:Connect(function()
if cooldown == false then
cooldown = true
animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
animation:Play()
elseif cooldown == true then
wait(cooldownTime)
cooldown = false
end
end)
end)
script.Parent.Unequipped:Connect(function()
animation:Stop()
end)
Questions concerns and bugs, just comment!
1 comment
When are you looking for it to cooldown? Before you unequip or during unequipped?