I keep getting the attempt to index nil with 'WaitForChild error

I’ve been looking all over the developer forum and I can’t find any topics related to this issue I’m having. I’m trying to define a players humanoid with a local script using :WaitForChild and for some reason it keeps saying, attempt to index nil with 'WaitForChild. Here’s the code:

local player = game.Players.LocalPlayer

local character = player.Character

local Humanoid = character:WaitForChild("Humanoid")

The character is not loading so fast, use this instead:

local character = player.Character or player.CharacterAdded:Wait()
1 Like

Sometimes the Character doesn’t load entirely, might wanna do

local Character = player.Character or player.CharacterAdded:Wait()

To have another failsafe option just to be sure

2 Likes