Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I fix "Humanoid Isn't a valid member of Player"?

I have this issue where it says "Humanoid isn't a valid member of player" It is in a localscript and this is what I have

local player = game.Players.LocalPlayer
s = player.Humanoid
while true do
script.Parent.Text = s.Parent.Name
wait()
end

Basically, I have a ScreenGUI that has a textlabel and then this is a localscript is located inside of the textlabel.

1 comment

0

You're missing 'Character'

1 answer

✓ Accepted answer

Humanoid is apart of the Character, not the Player

We can get the Character by doing player.Character. You can use .Character on any player to get the character. Sometimes the Character hasn't loaded though, so you would wait for the event CharacterAdded to fire. Example,

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local s = char:WaitForChild("Humanoid")
while wait() do
	script.Parent.Text = s.Parent.Name
end
I also used WaitForChild on the Humanoid, and changed the loop for the wait to be in the while loop to make things smaller.

Good Luck!

If I helped, please don't forget to accept my answer!

This discussion is preserved as it was. New answers, comments, and votes are closed.