Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My idle animation script won't unload. What should I do?

Asked by 5 years ago

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)

example

0
don't worry about whiz's comment he is just being dumb like always User#24403 69 — 5y

Answer this question