Play() not working

So I am making an animation for my game, and im making it activate once i say a message as a test, but every time I try to do it, it doesnt work, and it just shows this.
image

I don’t know if this is an update or anything, but, im still trying to figure it out.
this is the script
image

6 Likes

You need to run :Play() on the animator object, not the animation object.

Create the animator, then run :LoadAnimation on it, passing the animation object as the parameter. Then run :Play() on the animator

4 Likes

I don’t know how to make an animator though, I’m a little new to scripting.

2 Likes

You can insert it like any other object in the game! Right click somewhere, then insert object, then animator

2 Likes

This is my explorer, dont know if anythings wrong with it
image

But this is what it says in output
image

3 Likes

What line of code is causing the Argument 1 is missinng or nil error?

3 Likes

None it just says that, theres nothing else

2 Likes

What’s the blue text below it?

Can you please send over your current code?

3 Likes

image
image

2 Likes

Argument 1 is the animation you have

local LoadedAnimation = script.Parent.AnimationController.Animator:LoadAnimation(Animation)
LoadedAnimation:Play()
2 Likes

Nothing will happen, and theres no errors

1 Like

Have you done script.Parent.Animation or set “Animation” to whatever variable you have for it?

1 Like

I dont know what you mean by that

In my reply with the code, you can’t just put :LoadAnimation(Animation) as Animation doesn’t exist, it’s just a placeholder for you to put in your animation.

I put local Animation = script.Parent.Animation, I’m pretty sure it creates a variable for Animation

Just noticed something, you need to put the Animator object inside the Humanoid
Adjust your code to script.Parent.Humanoid.Animator

As @TaxFraudBruh said, put the animator object inside the humanoid. However, that error is likely because the controller hasn’t loaded yet, so try :WaitForChild()

Im confused, do I put the AnimationController into humanoid to?

No, only just the Animator and you need to update your script as I said before