Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

here is script

local trackanimation = nil

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

end)

1 comment

0

Use code block.

1 answer

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)

1 comment

0

https://developer.roblox.com/en-us/api-reference/event/Tool/Unequipped this is the dev hub page if you need another reference

This discussion is preserved as it was. New answers, comments, and votes are closed.