My NPC animations gives me this msg: AnimationTrack limit of 256 tracks for one Animator exceeded

Hello! I get this message sometimes, but not all the time. Usually, when the game has been on for a long time it starts. Where I think it comes from is when my NPCs move around in my game.


I just put the normal “Animate” script (it is not a local script) that every character has in my NPCs. Should I not do that? Also when I got this message the game has been on for 6 hours in studio. And I had around 20 NPCs walking around in the game.

wait()
for _, object in pairs(script.Parent.Parent:GetChildren()) do 
	if object:IsA("BasePart") then 
		object:SetNetworkOwner(nil)
	end
end
local health = script.Parent:WaitForChild("Health")
local mouth = script.Parent.Parent:WaitForChild("Slime").Mouth
local chaseTarget = script.Parent:WaitForChild("ChaseTarget")
local X = script.Parent.Parent.PrimaryPart.Position.X
local Z = script.Parent.Parent.PrimaryPart.Position.Z
local walkL = script.Parent.WalkL

local humanoid = script.Parent.Parent:WaitForChild("Humanoid")
local db = false
local takenDamage = false

local function walk()
	if db == false then
		db = true
		while true do
			if chaseTarget.Value == true or takenDamage == true then
				db = false
				break
			end

			local waitTime = math.random(1,60)/10
			wait(waitTime)
			
			humanoid.WalkSpeed = 13
		
			local Xnew = script.Parent.Parent.PrimaryPart.Position.X
			local Znew = script.Parent.Parent.PrimaryPart.Position.Z
		
			local random = math.random(Xnew - walkL.Value,Xnew + walkL.Value)
			local random2 = math.random(Znew - walkL.Value,Znew + walkL.Value)

			if takenDamage == false then
			script.Parent.Parent.Humanoid:MoveTo(Vector3.new(random,0,random2))
			end
		end
	end
end

health.Changed:Connect(function()
	takenDamage = true
	local Xnew = script.Parent.Parent.PrimaryPart.Position.X
	local Znew = script.Parent.Parent.PrimaryPart.Position.Z

	local random = math.random(Xnew - walkL.Value*2,Xnew + walkL.Value*2)
	local random2 = math.random(Znew - walkL.Value*2,Znew + walkL.Value*2)
	
	db = true
	
	script.Parent.Parent.Humanoid:MoveTo(Vector3.new(random,0,random2))
	humanoid.WalkSpeed = 25
	wait(5)
	takenDamage = false
end)

while true do
	walk()
	wait(1)
end

Maybe it has something to do with this script? It is my walking script for the NPC, probably not the best but it works. Or is it just the “Animate” script that Roblox made?

The NPC is a custom character with bones in it if that helps.

Any help would be amazing, thank you for your time!
/Xsodar

With reference to the error you’re getting, that means you’ve loaded too many animations onto the animator, try removing some? If you add animations in a loop and don’t break it then they’ll keep being added.

Yeah I know I have to do that somehow. But I thought the “Animate” script that Roblox made should do that for me. I’ll try it though, thanks.

1 Like