You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
Animation plays on NPC
- What is the issue? Include screenshots / videos if possible!
It doesn’t work. It shows this error
AnimationTrack limit of 256 tracks for one Animator exceeded, new animations will not be played. (x1032) - Studio
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I already searched on social medias but none of them would solve my problem
If you wondering wheres the animation code
local Animator = humanoid:WaitForChild("Animator")
local WalkAnim = script:WaitForChild("Animation")
local AnimLoad = Animator:LoadAnimation(WalkAnim)
AnimLoad:Play()
local CollectionService = game:GetService("CollectionService")
local animId = 8724952905
game:GetService("RunService").Heartbeat:Connect(function()
task.wait()
for _, mob in pairs(CollectionService:GetTagged('mob')) do
task.spawn(function()
if #CollectionService:GetTags(mob) < 1 then return end
local humanoid = mob:WaitForChild("Humanoid")
local Torso = mob:WaitForChild("HumanoidRootPart")
local dmg = mob.Settings.Damage.Value
local cooldown = mob.Settings.AttackCooldown.Value
local range = mob.Settings.AttackRange.Value
local coolingDown = mob.Settings.CoolingDown
mob.BillboardGui.Frame.TextLabel.Text = humanoid.Health .. "/" .. humanoid.MaxHealth
local closestChar
for _, player in pairs(game.Players:GetPlayers()) do
local char = player.Character
if char and char:FindFirstChild("HumanoidRootPart") and char.Humanoid.Health > 0 then
local distance = (char.HumanoidRootPart.Position - Torso.Position).Magnitude
if not closestChar then closestChar = char end
local clocestDistance = (closestChar.HumanoidRootPart.Position - Torso.Position).Magnitude
if distance < clocestDistance then
closestChar = char
end
end
end
if closestChar then
humanoid:MoveTo(closestChar.HumanoidRootPart.Position)
local Animator = humanoid:WaitForChild("Animator")
local WalkAnim = script:WaitForChild("Animation")
local AnimLoad = Animator:LoadAnimation(WalkAnim)
AnimLoad:Play()
if not coolingDown.Value then
local ray = Ray.new(Torso.Position, Torso.CFrame.LookVector * range)
local part = workspace:FindPartOnRay(ray, workspace:WaitForChild("MobsFolder"))
if part then
local player = game.Players:GetPlayerFromCharacter(part.Parent) or game.Players:GetPlayerFromCharacter(part.Parent.Parent)
if player then
coolingDown.Value = true
player.Character.Humanoid:TakeDamage(dmg)
task.wait(cooldown)
coolingDown.Value = false
end
end
end
end
end)
end
end)