Looped animation not looping?

Hey all!

I’m having a strange issue with an animation track. I’m not sure I can provide much information on the issue, but I’ll give you as much as I can.

Description
Basically, I’m loading a track into the player’s humanoid (server sided, if that matters), setting Looped to true, and setting priority to Action. However, after playing the track, the track will indeed play, but after the track ends, it does not loop.

The animation itself does not involve any actual movement (it’s a still animation of both arms “holding” an object).

It plays for approx 2 seconds before the animation ends and it reverts back to the Roblox core animation.

Any ideas?

Edit: For the sake of redundancy, I re-uploaded the animation with the priority already set to action. This didn’t fix the issue.

3 Likes

That’s weird, can you send screenshots?

1 Like

Sure!

While idling:
https://gyazo.com/edaafbe6887ad218906b04b574cee5cb

While running:
https://gyazo.com/aea213ed39cd6c6f4e9ea669cb66ff86

Another side note, if I begin running while the animation is playing, the animation will be cancelled out by Roblox core animation, even though I have it set to play as an action. If I’m already running when the animation begins, it plays through just fine.

Sorry, edit. Seems like beginning to run while the track is playing actually doesn’t affect it.

Did you enable loop at the beginning or at the end of the animation. I remember having this problem in the past and I think that might be the issue.

1 Like
wait(5)
local track = game.Workspace.RoyalBobby202.Humanoid:LoadAnimation(script.Animation)
track.Looped = true
track.Priority = Enum.AnimationPriority.Action
track:Play()

note that this is a test script and that’s the only reason I’m hard coding my character name in

2 Likes

Hmm, I haven’t looped an animation using a script before, I usually use the loop button(blue box) image

7 Likes

Ah, don’t know why I didn’t do that to begin with.

This worked, however, seems very counter-intuitive (and potentially a bug?) that setting the Looped property during run-time didn’t work.

1 Like

Glad I could help, I think the reason it’s not working is because animations can’t be looped via script and can only be looped via the animation editor.

1 Like

I assume this is a bug, because according to the developer hub, what you were doing originally should’ve worked.

4 Likes

It should have worked as I had expected, at least according to the wiki

I’ve submitted a bug report, hoping to get a reply.

2 Likes

Thanks for the info, I did submit a bug report. :slight_smile:

1 Like

Just following up, this sounds like the bug reported here: AnimationTrack.Looped Does Not Replicate.

Essentially, the loop logic doesn’t replicate between the client/server boundaries. Playing the animation on the server will loop it on the server, same goes for the client. You can visualise it in a play solo session by toggling between both.

This shouldn’t be an issue if you set the property from the animation editor.

12 Likes

Well, i create a “solution”

I just create a “While true do” for this problem

Example:

local humanim = hum:LoadAnimation(script:FindFirstChildOfClass("Animation")) -- Load Anim
local animtime = 4 -- The Animation Time Duration (You can look it on your Animation Editor)

--Playing Animation--

while(animtime) do -- Loop
		humanim:Play() -- We play the animation
	wait(animtime) -- every animends we stop the anim and this starts again 
	    humanim:Stop() -- We stop de anim for safety
end
1 Like