PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetPlayingAnimationTracks

This function returns an array of all AnimationTrack|AnimationTracks that are currently being played on the Humanoid.

A typical use for this function is stopping currently playing tracks using AnimationTrack/Stop.

Note this function will not return AnimationTrack|AnimationTracks that have loaded but are not playing. If the developer wishes to track these they will need to index them manually. See below for one example of how this could be achieved:

local animationTracks = {}
local track = humanoid:LoadTrack(animation)
table.insert(animationTracks, track)

Returns

Return Type Summary

An array of currently playing AnimationTrack|AnimationTracks


Code Samples


Stop Playing Animations

The code below gets a list of the AnimationTrack|AnimationTracks current being played for the Players/LocalPlayer|localplayer using the Humanoid/GetPlayingAnimationTracks function. Then, the code iterates through the list and stops all of the tracks using the AnimationTrack/Stop function.

local Players = game:GetService("Players")

local localPlayer = Players.LocalPlayer

if not localPlayer.Character then
	localPlayer.CharacterAdded:Wait()
end

local humanoid = localPlayer.Character:WaitForChild("Humanoid")

-- Get playing animations
local AnimationTracks = humanoid:GetPlayingAnimationTracks()

-- Stop all playing animations
for i, track in pairs (AnimationTracks) do
	track:Stop()
end