Improved documentation around spawning players with Player:LoadCharacter() and Players.CharacterAutoLoads

For Player:LoadCharacter() I am talking about this page: https://developer.roblox.com/en-us/api-reference/function/Player/LoadCharacter

Currently, this is the description of the method:

The LoadCharacter Player function creates a new character for the player, removing the old one. It also clears the player’s Backpack and PlayerGui . This is useful in cases where you want to reload the character without killing the player, such as when you want to load a new character appearance after changing the player’s Player.CharacterAppearance .

Loading a player character is not a simple process however and this page neglects to mention many of these details.

  • In order to load a character, Roblox needs to know what the player is wearing. This means a web-request is made to get the player’s outfit. This outfit is not stored as players can change their looks on the website and have it update their in-game character after respawning. These web-requests take time however, so if you were to respawn a couple dozen characters in a server in a loop, your code might yield for a second or two, and maybe even more than 10 seconds if the Roblox web is acting up. This means the method should be wrapped into a coroutine or spawn function if it is important that your code does not yield!

  • If a Model is parented to the StarterPlayer service and this model is called StarterCharacter, Roblox will not load the player’s character from the website and instead use the StarterCharacter model as a template for the newly spawned character. This is not documented on the page!

  • Adding onto the previous point, will Player:LoadCharacter() yield when a StarterCharacter model is available in the StarterPlayer container? A template is available within the server so no web-request is required to get the player’s outfit right? I would assume that the method does not yield in that case, but again, this is not documented on the page and definitely has to be!


For Players.CharacterAutoLoads I am talking about this page: https://developer.roblox.com/en-us/api-reference/property/Players/CharacterAutoLoads

This page also neglects a detail that can easily lead to confusion for new developers.

  • A player’s UI will not load until the player’s character is first initialized. So if you want to make a game with manual character spawning where your character does not exist until you’ve navigated past a menu in the game, you will actually have to spawn the character once in an out-of-bounds area, because your UI will not be initialized otherwise!
13 Likes