so i have this script inside a tool to play a animation when the player clicks with the tool out.
local debounce = true
script.Parent.Equipped:Connect(function(Mouse)
Mouse.Button1Down:Connect(function()
if debounce == true then
debounce = false
animation = game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Animation)
animation:Play()
wait(1.5)
debounce = true
end
end)
end)
script.Parent.Unequipped:Connect(function()
animation:Stop()
debounce = false
end)
i am having issues specifically with this part of the script
script.Parent.Unequipped:Connect(function()
animation:Stop()
debounce = false
end)
sometimes when you unequip and equip the tool the script will just stop working. the animation will just stop playing. any idea how to fix this?
