Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to stop all playing animations?

local Humanoid = game.Players.LocalPlayer.Character.Humanoid
local ActiveTracks = Humanoid:GetPlayingAnimationTracks()
for _,v in pairs(ActiveTracks) do
    v:Stop()
end

Works, but one of my looped idle animations doesn't stop. Is there a fix?

3 answers

Change all your custom animations' priorities to Action.

Maybe the problem is not from this code.

Change the priority by this:

local AnimationTrack = Humanoid:LoadAnimation(Your animation here)
AnimationTrack.Priority = Enum.AnimationPriority.Action
AnimationTrack:Play()--Then play it

1 comment

0

When I said Idle I didn't mean the animation priority. It's been at Action, it's just looped and when I run my code, the looped animation wouldn't stop.

local Humanoid = game.Players.LocalPlayer.Character.Humanoid
local ActiveTracks = Humanoid:GetPlayingAnimationTracks()
for _,v in pairs(ActiveTracks) do
    v:Stop() -- Stop animationTrack
    v.Looped = false -- Disable loop
end

1 comment

0

All this code does is stop any animation once it starts playing, breaking my code. The problem from my original code was that if a looped animation was playing, it wouldn't stop.

This discussion is preserved as it was. New answers, comments, and votes are closed.