Character Issues

Hello, I have a problem with character children because everytime I try to get something such as the Humanoid, it says it didn’t load in time. I put in stuff like

local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char.Humanoid

even if I “waitforchild” on the item, it doesn’t work. I have tried countless waits and connects but it never works. Does anybody know how to do this? It doesn’t even work for body parts, even the humanoidrootpart.

does the character load? and where do you place that script

I do local scripts, and yes it does load.

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
    character = player.CharacterAdded:wait()
end

orgin
does this work

Did you only try waitforchild for the character?
because you also should do that when grabbing the humanoid.

local player = game:GetService("Players").LocalPlayer
local char = plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

This should work ^

sorry for lateness i will try both

Yes, I did. I do

local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()

The code is correct but do like

local hum = char:WaitForChild("Humanoid")

Or if you find some tecnical difficulties with the char try:

player.CharacterAdded:Connect(function(char)
      local hum = char:WaitForChild("Humanoid")
      --- Stuff
end)

Use waitforchild with the humanoid too
like how I did in my reply above.
Humanoid doesn’t load at the same time the character does, so the script tries to grab the humanoid before it is loaded.

Iro solved my question, sorry.

1 Like