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

How can I trace an AnimationTrack while it is looping?

I have this animation loop that starts when a tool is equipped, and I want to break out of the loop when the tool is unequipped. How can I return the AnimationTrack so that I am able to use the Stop() function on it? Currently I switch out the tool holding anim in the character by changing the animationId, but I can not find the loop again.

^ I know this was a terrible description of my problem, but I hope you understand the question and are able to help me (:

Thanks!

1 answer

✓ Accepted answer

Use multiple animations in the character, make a variable of the AnimationTrack of each. Use the Unequipped event to disable the animation(s).

Tool.Equipped:connect(function(mouse)
	char = workspace:FindFirstChild(game.Players.LocalPlayer.Name)
	if char then
		anim1 = char:LoadAnimation(char.Anim1)
		anim1:Play()
	end
end)

Tool.Unequipped:connect(function(mouse)
	if anim1 then
		anim1:Stop()
	end
end)

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