To don't have a lot of load animation, I need a pairs function who search animation, this is my script:
anim = humanoid:GetPlayingAnimationTracks() for i, track, track2 in pairs (anim) do if track.Name == "Stand" and track2.Name == "Walk" then track:Stop() track2:Play() end end
And in output this said "tried to call a nil value with track2.Name" So how can I do, please?
You're doing it incorrectly. Here's an example of how to do a in pairs loop.
for i, v in pairs(workspace:GetChildren()) do print(v.Name) -- prints everything in workspace end
Edited code:
anim = humanoid:GetPlayingAnimationTracks() for i, track in pairs(anim) do if track.Name == "Stand" then track:Stop() elseif track.Name == "Walk" then track:Play() end end
Thanks, but this don't work because I want stop an animation then play an animation, but with this script, only the animation is stopped or is played.