Why is character taking upwards of 20-30 seconds to load in

function CharacterManager:Setup(player)
	if player.UserId > 0 then
		print('Setting up')
		local HumanoidDescription = Players:GetHumanoidDescriptionFromUserId(player.UserId)
		print('Description found')
		HumanoidDescription.Head = 0
		HumanoidDescription.Torso = 0
		HumanoidDescription.RightLeg = 0
		HumanoidDescription.LeftLeg = 0
		HumanoidDescription.RightArm = 0
		HumanoidDescription.LeftArm = 0
		
		player:LoadCharacterWithHumanoidDescription(HumanoidDescription)
		print('Loaded')
	else
		player:LoadCharacter()
	end
end

The first 2 prints work, but the last print (‘Loaded’) can take UPWARDS of well over 20 seconds. The first 2 prints print instantly. My internet speed isn’t that slow (I live in aus, so it’s always slow :man_shrugging:) but it’s never been THIS slow to load the player

Conceptually there’s nothing surprising about this if your network is sufficiently slow / hiccupy. GetHumanoidDescriptionFromUserId is just a single web request returning what amounts to a fancy list of asset IDs, that is, a very small packet of data. LoadCharacterWithHumanoidDescription has to actually fetch the content of all of those avatar assets, which is a much larger task.

Also, you should cache the results of Players:GetHumanoidDescriptionFromUserId in a table, that call takes a decidedly non-zero amount of time even the second time you call it with the same argument.

2 Likes

Well GetHumanoidDescriptionFromUserId seems to work immediately on entering, it’s only LoadCharacterWithHumanoidDescription which is taking forever, which makes no sense. If GetHumanoidDescriptionFromUserId is the one making requests to the web, then why is that instant and simply loading the character not? Doing LoadCharacter() works instantly, so I don’t see why loading the character with a set humanoid description should take any longer, especially since the humanoids description has already been set, it should be instant