Attempt to index nil with 'LoadAnimation()'

Ello,

I’ve used the :LoadAnimation() function many times before, but today I’m not entirely sure why it’s not working. When I test out the script, I get the error below saying attempt to index nil with ‘LoadAnimation()’. If you can help me out I would very much appreciate it, btw, everything is inside a LocalScript.

5 Likes

Are you assigning humanoid to the right varible? I don’t think you should use or when assigning variables.

But did you :Play() it? I don’t see any instances of you playing it in this picture

No I think the problem is inside the script assinging the variable humanoid

That shouldn’t be an issue. I’ve turned the humanoid into a variable and it worked. Also, I can clearly see you post. You don’t want to clog up a topic with repeated posts.

1 Like

Always use :WaitForChild() when getting stuff inside the character. This is because sometimes, the character does not load in properly, therefor causing your script to completely break.

Instead of FindFirstChild(“Humanoid”) use WaitForChild() and see if anything changes.

7 Likes

Yeah that seems like the solution for assinging the humanoid value.

2 Likes

Thanks so much! This seemed to be the problem.

1 Like

Wow, very true, thank you for your Always use :WaitForChild() , it really helps me! :smiley: :smile:

3 Likes

This really helped me, thank you! :smile: