Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to get a load animation who is stopped?

Asked by 3 years ago

Hello, I have did a stand and walk scrip:

anim = humanoid:GetPlayingAnimationTracks() 
for i, track in pairs (anim) do
if track. Name == "Stand" then
track:Stop()
walk = Humanoid:LoadAnimation(script.Parent.Walk) -- The problem is here
Walk:Play()
end
end
for i, track in pairs (anim) do
if track. Name == "Walk" then
track:Stop()
stand = Humanoid:LoadAnimation(script.Parent.Stand) -- The problem is here
stand:Play()
end
end

This script work, but the problem is than when I stand, walk fastly, then in output there are written "AnimationTrack limit of 256 tracks for one Animator exceeded, new animations will not be played" then the script no more work. So my question is there are a way to get stopped animations tracks? Or maybe you have another idea?

3 answers

Log in to vote
0
Answered by 3 years ago

did u accidentally capitalize your "humanoid" variable

0
Yes Geohad0926 5 — 3y
Ad
Log in to vote
0
Answered by
Elyzzia 1294 Moderation Voter
3 years ago

instead of trying to get the animations after they've been stopped, just save them in a variable (or a table if you have a lot of animations in a single script)

-- at the top of your script
local walk = Humanoid:LoadAnimation(script.Parent.Walk)
local stand = Humanoid:LoadAnimation(script.Parent.Stand)

you don't have to play an animation right after loading it either, you can play them whenever you want

a mistake i see a lot of people make is loading their animations every single time they want to use them, but you only need to load them once

Log in to vote
0
Answered by 3 years ago

Thanks, but It's what I did in a another script I have load the stand and the walk animation only one time, but my problem is than if I do:

anim = humanoid:GetPlayingAnimationTracks()
for i, track in pairs (anim) do
if track.Name == "Stand" then -- but now the problem is here
track:Stop()
end
if track.Name == "Walk" then
track:Play()
end
end
for i, track in pairs (anim) do
if track. Name == "Walk" then
track:Stop()
end
if track.Name == "Stand" then -- but now the problem is here
track:Play()
end
end

But the problem than the script work to stop animation but not to play animation, because :GetPlayingAnimationTracks() work only for playing animation, so like the animation who must be playing is stopped so :GetPlayingAnimationTracks() can't get the stopped animation, so my questions was how to get this stopped animations or if there are other way to work it.

Answer this question