I'm getting the error: AnimationTrack limit of 256 tracks for one Animator exceeded, new animations will not be played. How do I clear animations from the animator so that I don't run into this error? I am using a character to open/close a door, so I made a couple of animation tracks for the character to either have to door open or closed. With the method I am using, I loop the animation every so often, checking if the door is supposed to be open or closed. This is my script currently:
closed= 6132531871
open = 6132539757
--load
local animopen = Instance.new("Animation",script.Parent)
animopen.AnimationId = "rbxassetid://"..open
local animclosed = Instance.new("Animation",script.Parent)
animclosed.AnimationId = "rbxassetid://"..closed
while true do
val = script.Parent.Value.Value
if val == true then
local kopen = script.Parent.Humanoid:LoadAnimation(animopen)
kopen:Play()
wait(.2)
print("open")
elseif val == false then
local kclosed = script.Parent.Humanoid:LoadAnimation(animclosed)
kclosed:Play()
wait(.2)
print("closed")
end
end
I've also tried to load 2 animations into Humanoid at the start, then call them afterwards, like this:
closed= 6132531871
open = 6132539757
--load
local animopen = Instance.new("Animation",script.Parent)
animopen.AnimationId = "rbxassetid://"..open
local animclosed = Instance.new("Animation",script.Parent)
animclosed.AnimationId = "rbxassetid://"..closed
local kopen = script.Parent.Humanoid:LoadAnimation(animopen)
local kclosed = script.Parent.Humanoid:LoadAnimation(animclosed)
while true do
val = script.Parent.Value.Value
if val == true then kopen:Play()
wait(.2)
print("open")
elseif val == false then
kclosed:Play()
wait(.2)
print("closed")
end
end
With the above script, it just gets stuck on one animation, whether I have val set to true or false.
Any ideas?

1 comment
I think its because you are looping the animation to play over and over, regardless if its playing already or not. if yourAnimationTrack.IsPlaying == false then yourAnimationTrack:Play() end