So we have a Knife script, That plays an animation when you click. But you can spam click the knife, and it just glitches it out? How could we add a delay or debounce in this to stop the animation from running too fast? Thanks. Server Script:
game.ReplicatedStorage.ShankIdle.OnServerEvent:Connect(function(player)
local idleanime = Instance.new("Animation")
idleanime.AnimationId = "rbxassetid://3789083756"
local hum = player.Character.Humanoid
local idleloader = hum:LoadAnimation(idleanime)
local sound1 = Instance.new("Sound", hum.Parent)
sound1.SoundId = "rbxassetid://3688156764"
idleloader:Play()
sound1:Play()
print("Equipped")
end)
game.ReplicatedStorage.Shank.OnServerEvent:Connect(function(player)
local idleanime = Instance.new("Animation")
idleanime.AnimationId = "rbxassetid://3789083756"
local hum = player.Character.Humanoid
local idleloader = hum:LoadAnimation(idleanime)
idleloader:Stop()
local anime = Instance.new("Animation")
anime.AnimationId = "rbxassetid://3789143130"
local hum = player.Character.Humanoid
local loader = hum:LoadAnimation(anime)
loader:Play()
wait(0.24)
idleloader:Play()
print("Shanked")
wait(0.5)
end)
game.ReplicatedStorage.QuitShankIdle.OnServerEvent:Connect(function(player)
local idleanime = Instance.new("Animation")
idleanime.AnimationId = "rbxassetid://3789083756"
local hum = player.Character.Humanoid
local idleloader = hum:LoadAnimation(idleanime)
idleloader:Stop()
print("Unequipped")
end)

2 comments
I already did a debounce. It didn't work, Oh and your's didn't work either.
Wait, I figured it out, I put the debounce in the wrong area, Thanks.