Why does "GetPlayingAnimationTracks" Animation name = "Animation" even though I am looping through on client?

I used a remote event, so I am looping through on client, but it still has the name “Animation”

Properly name animation objects

local animation = Instance.new("Animation")
animation.Name = "MyUniqueAnimationName"  -- This is just for your reference
animation.AnimationId = "rbxassetid://123456789"

Load and Play Your Animation

local character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local animationTrack = humanoid:LoadAnimation(animation)
animationTrack:Play()

Handling Animations Dynamically

local animations = {}

-- Load and play the animation
local function playAnimation(animationId, customName)
    local animation = Instance.new("Animation")
    animation.AnimationId = "rbxassetid://" .. animationId
    local animationTrack = humanoid:LoadAnimation(animation)
    animationTrack:Play()
    animations[customName] = animationTrack
end

-- Example of playing an animation
playAnimation("123456789", "MyCustomAnimation")

Looping Through Your Custom Animation Storage

for name, track in pairs(animations) do
    print(name) -- This will print "MyCustomAnimation" or any other custom names you've used
    -- You can also access the track properties here
end

It is named, I’m not instancing animation objects, they are pre-made

key is to reference them correctly, manage their playing state (perhaps in a table, indexed by their names), and use their names to control their behavior within your game.

Referencing the animations isn’t my problem

1 Like

So your saying it still has the name animation

When I print the name when looping through the playing animations, it prints animation instead of the name of the animation object

-- Assuming you have a list or a way to access your active animation tracks
for _, animationTrack in pairs(activeAnimations) do
    -- Access the Animation object associated with the AnimationTrack
    local animationObject = animationTrack.Animation
    -- Now print the Name property of the Animation object
    print(animationObject.Name)
end

Yeah, it prints animation for some weird reason, normally this occurs due to looping through on the server, but im looping through on the client, so I’m not sure why