How do I make this animation stop looping?

There’s this big issue I keep encountering with my NPCs having looped animations for no reason ever since Humanoid:LoadAnimation() became decrepated. Any reasons?

My code:

		local function PlayAnimation(obj, animid)
			local human = (obj and obj:IsA"Humanoid" and obj) or obj:FindFirstChildOfClass"Humanoid"
			if not human then
				warn("Cannot play animation in "..obj:GetFullName())
				local animator = human:FindFirstChildOfClass"Animator"
				local anim ="Animation")
				anim.AnimationId = animid
				if not animator then
					animator ="Animator", human)
				local animtrack = animator:LoadAnimation(anim)
				if animtrack then
					animtrack.Priority = Enum.AnimationPriority.Core

Did you have animation looped set to true when you published it?

How do I do that? I use the Roblox animator plugin…

There should be a a box there if it’s looped or not.


1 Like

I just figured out about KeyframeSequence.Looped. Yes, I realized this setting was set to true.

That works as well, too. Thanks! I see what that toggle animation button do.

1 Like