Still have questions? Join our Discord server and get real time help.
Log in to vote

Humanoid is not a valid member of model?

Asked by 10 days ago
Edited 10 days ago

Hey I am currently making a first person script and I am having a problem, the problem is is that it says "18:18:31.139 - Humanoid is not a valid member of Model", I honestly dont know what is happening. Please help.

local player = game.Players.LocalPlayer
local char = player.Character
local hum = char.Humanoid
local cam = workspace.CurrentCamera

cam.FieldOfView = 100
hum.CameraOffset =,0,-1)

for childIndex, child in pairs(char:GetChildren()) do
    if child:IsA("BasePart") and child.Name ~= "Head" then
            child.LocalTransparencyModifier = child.Transparency
        child.LocalTransparencyModifier = child.Transparency

Error: 18:18:31.139 - Humanoid is not a valid member of Model

1 answer

Log in to vote
Answered by
skvyy 153
10 days ago
Edited 10 days ago

The issue here is that you are getting the Humanoid before it is loaded into the game.

A better solution would be:

-- Variables:
local Camera = workspace.CurrentCamera

local Plr = game.Players.LocalPlayer
local Char = Plr.Character or Plr.CharacterAdded:Wait()
local Hum = Char:WaitForChild('Humanoid')

I hope this helps!

Please accept this answer if it helps you!


Answer this question