I'm making a pickaxe for my game and I want to have a idle animation that plays when the player has it equipped but i want it to stop playing when they unequip the tool. The animation plays when I equip the tool but when I unequip it the idle animation still plays and i cant get it to stop unless I reset my character. This is the script in the tool responsible for playing the idle animation. It is a local script
script.Parent.Equipped:connect(function()
local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
idle:Play()
end)
script.Parent.Unequipped:connect(function()
local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
idle:Destroy()
end)
I have also tried
script.Parent.Unequipped:connect(function()
local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
idle:Stop()
end)
but neither works for me and I don't see what I'm doing wrong.
