How many animations can you play on the client before performance issues?

local Remotes    = game.ReplicatedStorage:WaitForChild('Remotes')
local AnimRemote = Remotes:WaitForChild('AnimationEvent')

local function PlayAnimationEvent(Object, Animation, Speed, Interactions)
	local Track       = nil
	if not Speed then
		Speed         = 0
	end

	if not Interactions then
		Interactions  = 1
	end
		
	if Object:FindFirstChildOfClass('Humanoid') then
		Track = Object.Humanoid:LoadAnimation(Animation)
		for i = 1, Interactions do	
			if Track then
				Track:Play()
			end
			wait(Speed)
		end
	end
	
	if Object:FindFirstChildOfClass('AnimationController') then
		Track = Object.AnimationController:LoadAnimation(Animation)
		for i = 1, Interactions do
			if Track then
				Track:Play()
			end
			wait(Speed)
		end
	end
end

AnimRemote.OnClientEvent:Connect(function(Object, Animation, Speed, Iterations)
	spawn(function()
		PlayAnimationEvent(Object, Animation, Speed, Iterations)
	end)
end)

I have a local script which allows me to do simple client side animations for objects and stationary NPCs preforming basic standing tasks. Basically i can feed a remote event, “speed” and “Iterations” the speed determines how long before running the animation again, and iterations determines how many times to run it.

I’m getting ready to use this to animate boxes down a conveyor belt. So the speed will be 0 because the animation wont play after the first time, and iterations will be 1. I’m expecting maybe 10 - 35 animations playing at once. 35 definitely seems a little high.

Will the client be able to handle this no problem?

1 Like