local tool = script.Parent local debounce = false local anim = Instance.new("Animation") anim.AnimationId = "rbxassetid://7226679754" --Put your animation id here if not debounce then local track -- Play animation tool.Activated:Connect(function() track = script.Parent.Parent.Humanoid:LoadAnimation(anim) track.Priority = Enum.AnimationPriority.Action track.Looped = false track:Play() debounce = true print("anim played") wait(0.5) debounce = false end ) tool.Unequipped:Connect(function() --Stop animation if track then track:Stop() end end) end
The main part is the debounce all it does is say anim played but i can still spam click and the animation plays every time
local tool = script.Parent local debounce = false local anim = Instance.new("Animation") anim.AnimationId = "rbxassetid://7226679754" --Put your animation id here local track -- Play animation tool.Activated:Connect(function() if not debounce then debounce = true track = script.Parent.Parent.Humanoid:LoadAnimation(anim) track.Priority = Enum.AnimationPriority.Action track.Looped = false track:Play() print("anim played") wait(0.5) debounce = false end end) -- hallo guys welcome to my minecraft tool.Unequipped:Connect(function() --Stop animation if track then track:Stop() end end)