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

I am trying to wait for humanoid to load, but I am getting an error?

Asked by 2 years ago
local Players = game:GetService("Players")

local char = game:WaitForChild(Players.LocalPlayer.Character["Humanoid"])

local PShirt = char:FindFirstChild("Shirt")
local PPants = char:FindFirstChild("Pants")


wait(3)
print(PPants.PantsTemplate, PShirt.ShirtTemplate)

Error : Humanoid is not a valid member of Model "Workspace.Skeet4life"

0
You have to use the `WaitForChild` method of the `Character` to obtain the Humanoid. TheeDeathCaster 2368 — 2y

1 answer

Log in to vote
0
Answered by
boredlake 256 Moderation Voter
2 years ago

First of all, if you're going to use game.Players.LocalPlayer, make sure the code is in a LocalScript. Also, to use Instance:WaitForChild(), you need to only use a string with the name of the child, and put the rest before WaitForChild() like this:

local char = Players.LocalPlayer.Character:WaitForChild("Humanoid")
Ad

Answer this question