Why This Animation Is Not Playing

Hello. I want to play the cartoony idle animation so I took the animation id and put it on animation and wrote a script that plays animation but NOPE still not working it worked with other animations that I make what is going on?

the animation player script is

local anim = script.Parent:LoadAnimation(script.Parent.Animation)

anim:Play()
4 Likes

I can think of a number of things, but in order to narrow them down, could you show us a screenshot of your explorer depicting the NPC and script?

Is the parent a humanoid? If it is, Humanoid:LoadAnimation() isn’t now deprecated. Use Animator:LoadAnimation(), a child of the humanoid instead to play animations, unless the humanoid is an npc.

Use :WaitForChild on the humanoid to wait for the server to create the Animator.

No one likes a client sided only animator ;c

It’s a script and the script is inside the humanoid

What are you talking about? I gave you the solution.

It still doesn’t work but it worked with other animations that I made

What do you mean by that? I don’t understand. Is the humanoid an NPC?

Its a npc that i took from the build rig plugin

Seems like you forgot something, you’re supposed to check for/make the Animator before calling :LoadAnimation()

e.g

local function getAnimator(hum)
    local animator = hum:FindFirstChildWhichIsA(“Animator”)
    if (not animator) then 
        animator = Instance.new(“Animator”)
        animator.Parent = hum
    end
    return animator
end 
local animator = getAnimator(script.Parent)
animator:LoadAnimation(script.Parent.Animation):Play()

@SpecialTimeGaming

1 Like

Then try Humanoid:LoadAnimation() instead. Tell me if there’s an error.

This is the script that @SpecialTimeGaming started with, they have already tried this before.

bruh when i tried to set the robot animation pack idle that i bought it didnt worked BUT when i took it from animate > idle > animation1 on my character in explorer it worked what is going on???

Could it possibly be because it is unanchored? I’m a beginner so I’m not sure.

Its completely unanchored and if its anchored then animation would not play i unanchored it multiple times

1 Like

Just a note, Humanoid:LoadAnimation() still works.

Is this an NPC or a player’s character? If this is a character the animation might be being played over. To avoid this, you should change the Animation inside the Animate script.

If this is an NPC I’d recommend giving us more code and a picture of your hierarchy.

I’d try setting the Looped property of your animation track to true if it’s an NPC. (Your animation track is called anim)

Well when the game runs NO animation plays but when I used my idle animation from my animate local script in my character in explorer it worked

I think the problem is there is 2 idle animation and I SHOULD buy it so I can use it

Are you getting any errors? Could just be animation priority, so it is playing but you can’t see it due to a priority issue?

There isn’t any error and I checked it on the client and server side