Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Humanoid is not a valid member of model error?

Asked by
Avi_i 2
6 years ago
local Player = game.Players.LocalPlayer
local Char = Player.Character
local Hum = Char.Humanoid

says "Humanoid is not a valid member of model"

the error is on "local Hum = Char.Humanoid"

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Because it's not. When that script runs, the player is loaded, but the character isn't. A fix would be to use the CharacterAdded event.

wait()
local Player = game:GetService("Players").LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local Hum = Char.Humanoid
Ad

Answer this question