I'm making a hammer tool, and I added animations but there is no cooldown

now the tool is not working at all

Oops. Check the edit, it should work now.

oh wait it’s working now thanks a lot

local player = game:GetService(“Players”).LocalPlayer
local cooldown = 5
local debounce = false
local animationTrack
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild(“Humanoid”)
local animator = humanoid.Animator
local Hammer = script.Parent
Hammer.Activated:Connect(function()
if debounce == true then return end
local debounce = true
Hammer.Activated:Connect(function()
if not debounce then return end
local animation = Instance.new(“Animation”)
animation.AnimationId = “rbxassetid://121844901937516”

animationTrack = animator:LoadAnimation(animation)
animationTrack:Play()

task.wait(cooldown)
debounce = false
end)

Hammer.Unequipped:Connect(function()
if animationTrack then
animationTrack:Stop()
end
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.