Humanoid Description not applying reliably

Title says it all.
Around 80% of the time player:LoadCharacterWithHumanoidDescription() works as intended.
The other 20% of the time, the player’s avatar retains their original clothing.

The function works 100% of the time in studio.

Here is the code which uses it:

local kitfolder = serverscriptservice.Kits
		if player:GetAttribute("Position") == "GK" then
			kitfolder = serverscriptservice.Goalkeeper_Kit
		end
		local teamkits
		teamkits = kitfolder:FindFirstChild(kit)
		if not teamkits then return end -- this doesn't return
		local character = player.Character or player.CharacterAdded:Wait()
		local humanoid: Humanoid = character:WaitForChild("Humanoid")

		local description = humanoid:GetAppliedDescription()
		description.Shirt = teamkits.Shirt.Value -- I can guarantee these IDS
		description.Pants = teamkits.Pants.Value -- are valid
		player:LoadCharacterWithHumanoidDescription(description)

I know it’s getting to the final line, because in order for a player to join the game, they HAVE to have loaded because CharacterAutoLoads is set to false.

I’d really appreciate if someone could tell me whether my code is wrong, or this function is just inherently unreliable (and of course, provide a solution!).

it might be related to this Humanoid:ApplyDescription() not working as intended - #2 by 4SHN

1 Like

Thanks. Updated my code to this (stilll kinda gross, wish it worked differently:

local kitfolder = serverscriptservice.Kits
	if player:GetAttribute("Position") == "GK" then
		kitfolder = serverscriptservice.Goalkeeper_Kit
	end
	local teamkits
	teamkits = kitfolder:FindFirstChild(kit)
	if not teamkits then return end	
	local character = player.Character or player.CharacterAdded:Wait()
	if not character.Parent then
		character.AncestryChanged:Wait()
	end
	local humanoid: Humanoid = character:WaitForChild("Humanoid")
	if not player:HasAppearanceLoaded() then
		player.CharacterAppearanceLoaded:Wait()
	end
	local description: HumanoidDescription = players:GetHumanoidDescriptionFromUserId(player.UserId)
	local temp_hum_desc = players:GetHumanoidDescriptionFromUserId(1)
	description.Shirt = teamkits.Shirt.Value
	description.Pants = teamkits.Pants.Value
	humanoid:ApplyDescription(temp_hum_desc)
	task.wait(2)
	humanoid:ApplyDescription(description)
1 Like