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 = Vector3.new(0,0,-1) for childIndex, child in pairs(char:GetChildren()) do if child:IsA("BasePart") and child.Name ~= "Head" then child:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function() child.LocalTransparencyModifier = child.Transparency end) child.LocalTransparencyModifier = child.Transparency end end
Error: 18:18:31.139 - Humanoid is not a valid member of Model
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!