Animation being weird once then fine

The following code is part of a function that plays an animation when a move is done.

local pModel = effects.CreatePersonaModel(persona)
	effects.SummonPersona(plr, pModel)
	local anim = pModel.Humanoid.Animator:LoadAnimation(pModel.Humanoid.Animator.AtomSmasher)
	anim:Play()

When the persona model is first spawned, it is spawned in already playing its idle animation. Animation priorities are both set correctly. This is how it looks.


The first time it plays, it’s wonky. After that, it plays correctly every time.
Why is the first time so weird?

1 Like

you might want to try pre-loading the animation using a separate LocalScript in ReplicatedFirst
if that doesn’t work, you should try to monitor anything that may change after the first time it plays.

Sorry for the late reply.

First off, I’m doing all this on the server. I’m not sure if that is a problem or not, but it may be important.
Second, I’ve tried preloading it (again on the server) but because I’m cloning the model, preloading the model before parenting it into the workspace gives an error, “failure to load animationclipprovider” or something.

I have never tried Pre-loading the animation on a Server-Script, but if I’m not mistaken, that wouldn’t work to new players who have joined the game. place a LocalScript in ReplicatedFirst and do something similar to this:

local ContentProvider = game:GetService("ContentProvider")

for _, asset in pairs(allAnims:GetDescendants) do -- replace "allAnims" with the folder containing assets
	if asset:IsA("Animation") then
		
		ContentProvider:PreloadAsync({asset})
	end
end

by the way, regarding playing the animations in a Server-Script, I don’t think that is the problem.
I’ve tried playing animations like that, but it still works. just to make sure though, you could try playing the animations through a LocalScript