Hello! I have the following piece of code:
local tool = script.Parent
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=10499840369"
local track
tool.Equipped:Connect(function()
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Idle
track.Looped = true
track:Play()
end)
tool.Unequipped:Connect(function()
if track then
track:Stop()
end
end)
which is responsible for loading an animation and then stopping it after the tool is no longer equipped. It is a local script under the tool itsself. How would I make it so the animation actually stops after unequipping the tool? Right now the animation just stays after its unequipped.