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.
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.
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.
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).
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.
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)
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
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.
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.
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…