Looped Animations don't Loop 90% of the time

I am making an elevator style thrill ride and after many tests I have decided that using Animations for the movement is the best method as it is smooth and is consistent unlike constraints. The animation controller is inside a model with the bottom BasePart of the elevator and an invisible “Center” block for the Motor6D, the rest of the objects are welded to the “Bottom” part outside of the model. I have an animation for bringing the elevator to each of the levels and then once that is finished it plays an “idle” looping animation for that floor to keep it there until it is called to move to the next floor. These looping animations are set to be looping both by the script and when they were uploaded.
My issue is that these looping animations almost 90% of the time now do not loop and send the elevator position back to its zero/starting position, and messes up physics interactions that occur. When I first started testing this back in early 2020 this worked fairly well and consistent however starting in June this issue has been happening more and more frequent.


I have tried multiple solutions from adjusting the fadeTime, making sure every animation looped or not has a :Stop() before playing the next animation, etc. I am not sure if this is related to this bug: AnimationTrack.Looped Does Not Replicate
However the idle animations all have the Looped property checked before they were uploaded.

Here is a sample code which would achieve the same thing from the main script:

local LoadAnimation = require(game.ServerScriptService.LoadAnimation)
local Shared = require(game.ServerScriptService.IdleAnims)
local AnimTrack = LoadAnimation(ID1, script.Parent.Parent.Elevator.Bottom)
AnimTrack:Play(0)
AnimTrack.Stopped:Wait()
AnimTrack:Stop(5)
Shared.IdleAnimation = LoadAnimation(ID2, script.Parent.Parent.Elevator.Bottom)
Shared.IdleAnimation.Looped = true
Shared.IdleAnimation:Play(0)

This is what is in the LoadAnimation script:

function LoadAnimation(AnimationId, Part, Looped)
    local Anim = Instance.new("Animation")
    if tonumber(AnimationId) == nil and not AnimationId:match("rbxassetid://%d+") and not AnimationId:match("rbxasset://%d+") then return end
    Anim.AnimationId = "rbxassetid://"..AnimationId
    local AnimTrack
    -- Use humanoid if passed, otherwise use animation controller
    if Part:IsA("Humanoid") or Part:IsA("AnimationController") then
        AnimTrack = Part:LoadAnimation(Anim) -- Returns animation track
    elseif Part:FindFirstChild("Humanoid") then
        AnimTrack = Part.Humanoid:LoadAnimation(Anim)
    elseif Part:FindFirstChild("AnimationController") then
        AnimTrack = Part.AnimationController:LoadAnimation(Anim)
    else
        local AnimController = Instance.new("AnimationController")
        AnimController.Parent = Part
        AnimTrack = AnimController:LoadAnimation(Anim)
    end
    
    AnimTrack.Looped = Looped
    
    return AnimTrack -- Returns animation track
end

return LoadAnimation

Use while true do and loop this instead of using a property to do it.

This is not a viable solution and is not possible to use in my code as I have multiple scripts that control the idle animations.

Have you tried setting the priority of Idle animation to lower than the elevator animation?

What I usually do is that I’d play the “moving” animation and idle animation at the same time but with a slight delay on idle animation to prevent the instant repositioning. Oh and forgot to mention that my idle animation priority is lower than the “moving” animation.

Screen Shot 2563-10-17 at 20.30.46

I tried this and unfortunately it didn’t help.
Now just a little bit ago I tried something different by having the idle animation of a different floor play on its own to see if it even loads, and it never moved to that floor at all, meaning the animation never played. I tested this in Studio and the idle animations don’t work in Play Solo on the Client but on the Server it shows them working. This is some sort of replication bug.

I found out that the LoadAnimation module script was setting the Looped value to false if it wasn’t defined when being called, and after some testing I realized that the bug that is happening is that when 2 or more animations that were set as Looped in the Editor but not set as Looped in the AnimationTrack that was being loaded, the 2nd(or the last one) will stay looping and will not obey the :Stop() function until the offending animation was called to load and play again with the Looped property set to true on the AnimationTrack. This caused any looping animations that were loaded/played with Looped set to false before the offending animation to not load/play at all afterwards(Looped property set to true or false)
I have created a reproduction file to submit as a bug report.