I have been working on a script that upon equipping of a tool will load an animation that works fine but the part where it should unload the animation upon Unequipping the tools goes wrong as it will just stay in that position.
My code:
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://3181214661"
script.parent.parent.Equipped:Connect(function(mouse)
local anim = script.Animation
Local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local track = Humanoid:LoadAnimation(anim)
track:play()
end)
script.parent.parent.Unequipped:Connect(function()
local anim = script.Animation
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local track = Humanoid:LoadAnimation(anim)
track:Stop()
end)

1 comment
don't worry about whiz's comment he is just being dumb like always