Locally created rig won't play animations unless loaded countless times

I’m trying to make a first person shooter but for some reason the animations won’t play unless i load it a few times. I don’t have a clue on how to fix this.

local hands = game.ReplicatedStorage.Visualiser.Arms:Clone()
local rserv = game:GetService("RunService")

rserv.RenderStepped:Connect(function()
	hands.Head.CFrame = workspace.CurrentCamera.CFrame
	hands.Parent = workspace
end)

local idle = hands.Humanoid.Animator:LoadAnimation(script.Idle)
idle:Play()

hands is a humanoid character with invisible body parts. i use collision groups to make it not collide w the character and the head is anchored

Out of curiosity, have you tried loading the animation without the renderstepped loop?

yeah still didn’t work. ive tried placing the animation player above the renderstepped and still didnt work

Not entirely sure where this script it and when it runs but something you can try doing is waiting a bit, more specifically waiting for the character/player to fully load, and its important to run :Play() again if the character dies.

Besides that I’d recommend welding the hands to the character it’ll be a lot more optimized then constantly updating its CFrame in a loop.

Don’t set the parent in render stepped it resets the model constantly and it could pause the animation.

Animations take some time to load. Use ContentProvider:PreloadAsync to preload them for faster loading later.

Alternatively, just load the animation by using LoadAnimation a few seconds before it’s needed.

It works! thank you for telling me that.