Humanoid not a valid member of model

Looked around DevForum and I saw that people have the same issue, and when I try to use their results it doesn’t seem to work for me.

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


local idleAnim = humanoid:WaitForChild("Animator"):LoadAnimation(pT.animations.Idle)
local unholsterAnim = humanoid:WaitForChild("Animator"):LoadAnimation(pT.animations.unholster)

Here is a look at the stuff that is trying to get the humanoid, this has seemed to work for others but as I said it doesn’t work for me and it has left me pretty confused.

2 Likes

you declared a variable but proceed not to use them when defining the character?
also, what is pT? have you declared it beforehand?

make sure that you are writing this in a LocalScript

try this:

local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

if hum then
    print("Humanoid found.")
end

local animator = hum:WaitForChild("Animator")

local idleAnim = animator:LoadAnimation(pT.animations.Idle) -- define the pT path
local unholsterAnim = animator:LoadAnimation(pT.animations.unholster)
1 Like

Yeah, I declared PT and the animation stuff beforehand, this worked out though. Thank you!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.