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

How i can make my animation stop when i unequipped a tool?

Asked by
ipi11 0
3 years ago

here is script

local trackanimation = nil

script.Parent.Activated:Connect(function() trackanimation = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Move) trackanimation:Play()

end)

0
Use code block. Dovydas1118 1495 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

All you would really need to do here is create an unequipped event and stop your animation within it. Good luck with the game you are making! (please put your code in code blocks next time)

here is the source code without the unequipped event added:

local trackanimation = nil
script.Parent.Activated:Connect(function() 
    trackanimation = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Move)         
    trackanimation:Play()
end)

script.Parent.Unequipped:Connect(function()
    trackanimation:Stop()
end)
0
https://developer.roblox.com/en-us/api-reference/event/Tool/Unequipped this is the dev hub page if you need another reference natonator63 29 — 3y
Ad

Answer this question