Getting Animation Names With :GetPlayingAnimationTracks() On Server

When I play an animation onto the humanoid from the client, when I get the playing animations on the server with Humanoid:GetPlayingAnimationTracks(), the list comes out as “Animation 1”, “Animation 2”,

Is there a way to get their proper names?

-- Client
local ParryAnimation = Animator:LoadAnimation(WeaponAnimations.Parry)
ParryAnimation:Play()
-- Server
local CurrentStates = Humanoid:GetPlayingAnimationTracks()

for i,v in pairs(CurrentStates) do
                    
print(i,v)

end
Animation Name = Parry

Output:

1 Animation

For Reference, the animation being played is located in Replicated Storage.

1 Like
local marketplace = game:GetService"MarketplaceService"
local getProductInfo = marketplace.GetProductInfo

for _, animationTrack in ipairs(animationTracks) do --"animationTracks" is an array of currently playing animation tracks.
	local animationObject = animationTrack.Animation
	if not animationObject then continue end
	local animationId = animationObject.AnimationId
	if not animationId then continue end
	local success, result = pcall(getProductInfo, marketplace, animationId, Enum.InfoType.Asset)
	if success then
		if result then
			print(result.Name)
		end
	else
		warn(result)
	end
end

Something like this should work.

If the tracks’ animation objects hold their names then you can simply do the following.

print(animationTrack.Animation.Name)
9 Likes