0

I tried to apply a Humanoid Description on a player that joined the game but the output gives an error: "Attempt to index nil with humanoid". Heres is the code.

game.Players.PlayerAdded:Connect(function(Player)
    Player.Character.Humanoid:ApplyDescription(game.ServerStorage.HumanoidDescription)
end)

1 Answer 1

0

You should wait for the Character to load in the game. Before applying the HumanoidDescription.

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(character)
       wait()
       character:WaitForChild("Humanoid"):ApplyDescription(game.ServerStorage.HumanoidDescription)
    end)
end)

Sign up to request clarification or add additional context in comments.

4 Comments

but this returns a other error: Humanoid::ApplyDescription() DataModel was not available
@takezo try the updated version. I added the WaitForChild.
'Infinite yield possible on 'Players.Me:WaitForChild("Character")'
@takezo check again. That means you have to use wait before running that line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.