I had the same problem with the sound in the same tool. But that was with audio, which I fixed. Now it's with the animation which is why I think the same method I used on the other script isnt working.
What the problem is: It plays an animation on activation of the tool, waits, then stops. But if I unequip the item, it continues to play.
what I tried: I tried looking for people with similar problems, creating an if statement (if script.Parent.Unequipped then track:Stop()), destroying it, or equaling it to nil. Not sure what else to do.
here is my code, I tried to point out lines I need help on so you dont have to read the whole thing
local heal = script.Parent -- the tool -- the animation ID local cast = Instance.new ("Animation") cast.AnimationId = "http://www.roblox.com/Asset?ID=5207038516" local debounce = false heal.Activated:connect (function() --main function local char = heal.Parent local track = char.Humanoid:LoadAnimation(cast) --loading the animation if debounce then return end debounce = true track:Play() --plays animation wait (7) --what I think the problem is track:Stop() if heal.Unequipped then --what I tried (nil, destroy(), stop()) track = nil end debounce = false end) heal.Unequipped:Connect (function() --What I want the tool to do if it's unequipped local char = heal.Parent -- which it does do it, but not while the tool is playing the main function local track = char.Humanoid:LoadAnimation(cast) track:Stop() end)