How can I resume NPC animations after freezing them temporarily?

local animations = npc.Humanoid.Animator:GetPlayingAnimationTracks()
        for i, animation in pairs(animations) do
            animation:Stop()
        end

so uh
this is good to like stop the npc from doing that walking animation forever when i anchor their humanoidrootpart
but how do i get them to resume?

or, rather, should i use a different method of getting the animations to stop, instead of getplayinganimationtracks()? should probably pick a different category.

Use :AdjustSpeed(Speed) instead of stopping those animations.

https://developer.roblox.com/en-us/api-reference/function/AnimationTrack/AdjustSpeed

You can disable their animation script and reenable it whenever you’re ready to unanchor them.

yes but does that actually stop the current animation playing

so if this pauses the animations at 0, will it

-be frozen on the current keyframe

-return to a neutral state

Exactly.

30 Letterssssssssss

what

u didnt answer my question

If the NPC continues to play the walking animation, it should stop them from literally playing the animation but it’ll pause them on the keyframe they were on before you disabled it. If you want them to be at a neutral stance then one possible solution is creating your own custom walking animation with that neutral keyframe. Then, whenever you want the NPC to stop moving, pause the animation at the neutral keyframe then disable the script.

the question wasnt directed towards you it was towards the other guy talking about adjustspeed

speaking of, again

this question…?

He’s already answered your question mate.

I was just replying to you since you replied to me earlier but alright. Choose whichever method works for you.

so are you talking about disabling the script or are you talking about adjustspeed

I’m talking about my method of disabling the animation script, however, AdjustSpeed seems more convenient as you wouldn’t have to make your own custom animation (see my other replies).

exactly which is what ive been saying

so my question

is about adjustspeed, do you happen to know which of these two scenarios will occur if adjustspeed sets it to 0

Try this

local animations = npc.Humanoid.Animator:GetPlayingAnimationTracks()
for i, animation in pairs(animations) do
animation:Pause()
end

and do animation:Play() when you want to pla

does :Pause() freeze it on its current keyframe, or reset to a neutral position? because i need it to reset to a neutral position if possible
and if not possible by doing this kinda stuff then what method do i need to use to achieve it

Maybe try .TimePosition and set it to 0? like this.

local animations = npc.Humanoid.Animator:GetPlayingAnimationTracks()

for i, animation in pairs(animations) do
    animation.TimePosition = 0
end

If adjustspeed is set to 0, the animation will freeze on its current frame on when you froze it. To resume it again, just set adjust speed to 1.

you could just make the animation last long enough so it matches

ps: ik im late