Animation Scripting Problem

Hello Everyone!
I’ve been trying to script my animations recently and I’ve run into a problem :sob:


It says there is a problem on line 4 but I cant seem to find the problem
(If you couldn’t tell I’m trying to code my animations,so when I click a key it plays the animation)

1 Like

This is likely because the Character has not loaded properly yet therefore Humanoid is not a valid member of the Character. In order to fix this, you can do the following:

local char = player.Character
local human = char:WaitForChild("Humanoid") -- waits for the humanoid to load before advancing the script
1 Like

Thank you Legend for responding but
I tried what you said and it still didn’t work.If you have any other suggestions please let me
know :smiley:

Did you get anything in the output when you tried this?

no it was the same it said
Players.doddlehead26.PlayerScripts.LocalScript:4: attempt to index nil with ‘WaitForChild’
actually it was a little different

Ah, I figured out the issue. It’s the folder you’ve got it in. You have it in StarterPlayerScripts, which is why this is not working. I recommend you place this in StarterCharacterScripts or StarterGui and include the code I gave above and this will work.

1 Like

Thank you so much Lengend! :smiley:

1 Like