Player.Character (Help)

I wrote a script that is supposed to give players who join boxing gloves:

7d0e8622d6ee09138e7be29123c39926

However, the Player.Character is not working and is giving me this error:

d0f5ee16e319e7ba3e4a788011fa2158

“Player.Character.Humanoid.CharacterAppearanceLoaded:Connect(function()”

It should look like this

player.CharacterAppearanceLoaded:Connect(function(character)

2 Likes

The character doesn’t instantly exist - it has to spawn in. You’ll want to check if Player.Character is not nil, and if it is, wait for Player.CharacterAdded. And again, the Humanoid doesn’t instantly exist, you’ll need to wait for it once you’ve got a character using WaitForChild on the character.

Also as pointed out, even if both the character and humanoid did exist at the time the code ran (which they don’t from the error) you’d also run into an error as the event doesn’t exist under the Humanoid.

1 Like

When a player joins, it takes time for their character to load. To wait until the character is loaded, just do

local function playerAdded(player)
    local character = player.Character or player.CharacterAdded:Wait() --If the character doesn't exist, wait until it loads
    local humanoid = character:WaitForChild("Humanoid") --Even when the character is loaded, the humanoid may not be there yet
    
    --add the gloves
end

I waited for the character appearance to load (See the script).

You didn’t wait for it correctly. Again, character could be nil. So you are indexing a nil object. You have to use CharacterAdded.

No, its wrong. You dont wait for the apperance on the Humanoid, you wait for the apperance on the player

--Since the CharacterApperance already gets loaded, we can just use the character it returns--
Player.CharacterApperanceLoaded:Connect(function(char)
local BoxingGloveClone = BoxingGloves:Clone()
BoxingGloveClone.Parent = char
local Weld1 = Instance.new("Weld")
Weld1.Part0 = Character.LeftHand
Weld1.Part1 = BoxingGloveClone.LeftBoxingGlove
Weld1.C0 = Character.LeftHand:Inverse()
Weld1.C1 = BoxingGloveClone.CFrame:Inverse()
Weld1.Parent = BoxingGloveClone
local Weld2 = Instance.new("Weld")
Weld2.Part0 = Character.RightHand
Weld2.Part1 = BoxingGloveClone.RightBoxingGlove
Weld2.C0 = Character.RightHand.CFrame:Inverse()
Weld2.C1 = BoxingGloveClone.CFrame:Inverse()
Weld2.Parent = BoxingGloveClone
end)

Just use this, its your full code written out in the correct function.

I understand! Thank you so much for your help!

1 Like

Note, the humanoid doesnt even have a function that is when all the things are loaded in, its on the player, You don’t need to access the humanoid here. Niether the character, its on the player.

Ok, so now there are no more errors, however it’s not welding it to the player’s hands. It clones it and puts it in the workspace, but it’s not welding it to the players hands.

c88fea41aa92506c89d2409a7637486e

Does the character even have a left hand or a right hand?

Yes, there is a right and left hand.