Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 5 days 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 incapaxx 3086 — 5d

Answer this question