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