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

Humanoid is not a valid member of Model?

Sorry, this is probably stupid, but I really don't get it

local Player = game.Players.LocalPlayer
local Char = Player.CharacterAdded:Wait()
local Humanoid = Char.Humanoid

outputs "Humanoid is not a valid member of Model". How so? My script is in StarterPlayerScripts.

1 answer

✓ Accepted answer

Ensuring this is a Local Script, and simple fix

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid") -- WaitForChild is efficient since the script is ran as the game starts, without it, it wont find a humanoid.

3 comments

0

It just exited overflow with "Game script timeout". Is there something wrong with my studio? I honestly have no idea at this point.

0

Ok. And sometimes it doesn't... This is clearly a problem on my side. Tnx for the reply tho

0

Anytime

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