Delay in AnimationTrack:Play()

Hello,

When I use :Play() on an AnimationTrack, it takes a moment to actually play, but only for the first time :Play() is called on it; other times, it doesn’t have any delay.

Here’s a portion of my code:

local anims = {
	Windup = animator:LoadAnimation(animationsFolder:WaitForChild('Windup')),
	Swing = animator:LoadAnimation(animationsFolder:WaitForChild('Swing')),
}

anims.Windup.Looped = true
anims.Swing.Looped = false
anims.Windup.Priority = Enum.AnimationPriority.Action2
anims.Swing.Priority = Enum.AnimationPriority.Action3

local function deactivated()
	anims.Swing:Play() -- HERE: takes a second to play
	anims.Windup:Stop() -- stops immediately
end

local function activated()
	anims.Windup:Play(0.3) -- works fine
end

tool.Deactivated:Connect(deactivated)
tool.Activated:Connect(activated)

Video of the delay occuring:

I’ve tried stopping the Windup animation before playing the Swing animation, but it does the same thing. I’ve also tried putting the FadeTime in :Play() and :Stop() to 0. I’ve completely run out of ideas.

Thanks for your help!

1 Like

Nevermind, I figured out I can use a RemoteEvent and do animations on the client instead and that works perfectly.

1 Like