Animations delayed

Hi,

I’m trying to make a character spawn animation play immediately on spawn, with no visible delay. The animation asset is already preloaded on the loading screen using ContentProvider:PreloadAsync.

Even with Humanoid:LoadAnimation() + Play(0,1,1), I still notice a slight delay before the animation starts. Is there a reliable way to guarantee that the animation starts instantly on spawn for all players?

Thanks in advance!

 CustomDeploy.Function = function(plr:Player, model:Model)
	local humanoid = 
		model:FindFirstChildOfClass("Humanoid") or 
		model:WaitForChild("Humanoid")
	
	local root = 
		model.PrimaryPart or 
		model:FindFirstChild("HumanoidRootPart")
	
	local deploySound = Assets:WaitForChild("Deploy"):Clone()
	deploySound.Parent = workspace.TEMP
	deploySound:Play()

	cleaner:AddItem(deploySound)

	root.Anchored = true
	model.Parent = workspace
	
	task.wait(.5)
	
	local spawnAnimation = humanoid:LoadAnimation(
		Assets:WaitForChild("Spawn")
	)
	spawnAnimation:Play()
end

Hello! If I understood correctly, I’m pretty sure I’ve had this issue too. Loading an animation has a delay in itself, so what I’ve done is pre-load all animations as soon as possible before using them, caching and then running them whenever I want You can probably add a little loading screen on respawn to let it load. Not sure if it’s the most optimal way of doing it though.

If that doesn’t help you though, maybe you can manually manage resetting of characters by changing workspace.PlayerCharacterDestroyBehavior to Disabled, which should only parent characters to nil instead of destroying them, allowing you to conserve the Humanoid and keep the animations loaded (in theory). Do be wary of memory leaks, though.

Hope this helps

1 Like

Thanks for trying to help! I actually figured it out myself, it turns out you also need to preload the model before spawning it

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.