Question about LoadCharacter methods yielding?

The LoadCharacter and LoadCharacterWithHumanoidDescription are both yielding functions, but I’m unsure as to what the signifcance of these yielding functions finishing is?

When these functions finish does that mean the character’s appearance has fully loaded? Or their joints and attachments are fully setup and scaled?

I’m afraid the documentation for these pages isn’t really clear about what these functions completing means, but I’m hoping someone here can tell me. It’s useful to know this so I don’t have to use :WaitForChild() for instances this method may already guarntee.

Thanks!

2 Likes

To check what it means you should try in game with prints and see if it prints before the appearance loads or the joints and other are finished being setup. This is how I would go about it.

1 Like

The issue w/ that is that i may just have a good bout of internet. The methods definitely do yield, but the appearance/joint loading could still be synchronous and start at any given time during that method yielding.

3 Likes

It states on the forum that the LoadCharacterWithHumanoidDescription will load the character with the stuff they have on the humanoid description such as body color, scale, accessories. While Load characters on the other hand just makes a new character appearance(new starter character or avatar).

1 Like

Can you link that post please?

1 Like

Sure;
LoadCharacter; Player:LoadCharacter
LoadCharacterWithDescription; Player:LoadCharacterWithHumanoidDescription

1 Like

It seems to return before accessories and pants and shirts are loaded.

1 Like

Ah I thought you were referring to a post on the devforum.

Unfortunately those documentation pages have (imo) statements that have conflicts. For example on the LoadCharacterWithHumanoidDescription page it says

This function spawns an avatar so it has everything equipped in the passed in HumanoidDescription.

Which as you say alludes to everything being loaded when the player spawns

However, one line down it says:

After calling LoadCharacterWithHumanoidDescription for an individual player, it is not recommended to call the function again for the same player until after that player’s Player.CharacterAppearanceLoaded event has fired.

Which (imo) conflicts with the above b/c it implies that the avatar appearance might not be loaded when the method is finished yielding.

Do you have a source or a way to test that?

I tested a bit with :LoadCharacter and the thread seem to have returned before loading the aforementioned.
Here is the source:

local plr = game.Players.PlayerAdded:Wait()

plr:LoadCharacter()


local a = plr.Character:GetDescendants()

wait(2)

b = plr.Character:GetDescendants()

for _, va in next, a do
	for k, vb in next, b do
		if va == vb then
			b[k] = nil
			break
		end
	end
end

print(b)

Fore some reason it is the reverse of what they said it does I tested it.

LoadCharacter loads the character model or if it already exists, resets. Not any of its descendant.

If you want to make sure everything has loaded I suggest doing something like this:

function LoadCharacter(player)
    player:LoadCharacter()
    while not player.Character:IsDescendantOf(workspace) do
        player.Character.AncestryChanged:Wait()
    end
    return player.Character
end
1 Like

So then the character is not parented until its decendants are loaded? Again, I hate to keep badgering ppl, but is there a source for that?

I cannot reproduce. The character seemed to loaded in the workspace after :LoadCharacter

Rather, it doesn’t let you manipulate the characterModel until it has loaded into workspace. I am not well versed with the second api LoadCharacterWithHumanoidDescription, and I don’t have a solid source for this. However, we used to have similar issues with yielding the character in Horse Valley and I believe this is what we did to fix it.

Edit: As per your concern regarding character appearance, I do not have a solid solution.

1 Like

I kept reading and there is an event called Player.CharacterAppearanceLoaded and it says the action :loadcharacter or :loadcharacterwithdescription should not be used until this event is fired. :LoadCharacter also does not yield other tasks.

What do you mean by that are you talking about it won’t fire the loadcharacter function?

Well this is a mess. I found this post:

It shows both an old and a new avatar loading order (I don’t believe the new was ever implemented). Regardless which order it is though, it should yield until everything is loaded.

So really, I don’t know what to believe anymore. Thanks Roblox…

2 Likes

According to the link, it does look like my method is the most optimal way of solving your issue. Let me know if you have any further questions!

I believe what’s linked in the post is correct.

When these methods are finished the entire character should be parented and have its appearance loaded on the server.

That would explain why @Feedekaiser was getting values in the b table.

So tldr; It yields until the entire character is loaded accessories and all on the server. Client replication seems to be a whole other can of worms.

4 Likes