Character Loading is Always Non-Atomic For The Server

CharacterRepro.rbxl (53.0 KB)

^ This repro file contains a ServerScript that will help show the behavior issues.

In short, when a character is first loaded, the server is unable to observe them in their true state for an arbitrary amount of time. As if it were streaming in, in a non-atomic way. Not only do their parts load in one by one quite slowly, they’re not in the correct location.

In my game I’m trying to scale players to the same scale. This is required because the new UGC avatar items make it so regardless of game settings, players can be any size. What I’m doing is when characters are loaded, I measure the height of the character by the distance from their feet to their head, then scale accordingly.

The issue is, sometimes the measurement is wrong, and characters become massive. This implies the server believes that their head and feet are right next to each other. Sure enough, I went looking on a baseplate using that repro file and found that when a character is added using CharacterAdded it can take multiple frames before the character’s parts exist, it’s parented to workspace, and it’s moved to the appropriate location. This timing seems completely arbitrary, and it makes it very hard to detect when a character is fully loaded in or not.

This might be intentional as there is a function called CharacterAppearanceLoaded for handling when the character’s appearance has loaded. CharacterAdded is just for if the character is loaded in general and not the appearance.

If this is a bug, it would still be good to use CharacterAppearanceLoaded anyways.

2 Likes

Thanks for the report. We’ll follow up when we have an update for you.

1 Like

Hello :wave:

We recommend you use the Player.CharacterAppearanceLoaded signal to determine when it’s safe to query properties on the character instances.

1 Like

Doesn’t that fail when the character appearance fails to load?

Also how would I determine if it’s already loaded? If I put CharacterAppearanceLoaded:wait() inside the characteradded function isn’t it possible that it could yield forever if the appearance is already loaded in?

Player.CharacterAppearanceLoaded should always fire at the end of the character loading process. If you can find a scenario where it doesn’t, please file a bug report!

You can use Player:HasAppearanceLoaded() to determine if the character appearance has already loaded.

In your case, it might be simpler to just :Connect() to Player.CharacterAppearanceLoaded instead of Player.CharacterAdded.

1 Like