HasAppearanceLoaded unreliable?

I setup a module to clone the players character and keep a copy for reference.

Relevant part of that script:

local function CloneCharacter(character)
	character.Archivable = true
	local Clone = character:Clone()
	character.Archivable = false
	return Clone

function module.KeepOriginalCharacter(player)

	local PlayerCache = Cache:WaitForChild(player.Name)

	if PlayerCache then

		-- check if OriginalCharacter already exists

		if not PlayerCache:FindFirstChild("OriginalCharacter") then

			-- wait for appearance (from Roblox sample)

			local function WaitForAppearance()
				local loaded = player:HasAppearanceLoaded()

				while not loaded do
					loaded = player:HasAppearanceLoaded()
			-- clone/keep character

			local OriginalCharacterClone = CloneCharacter(player.Character)
			OriginalCharacterClone.Name = "OriginalCharacter"
			OriginalCharacterClone.Parent = PlayerCache



Later, another part of the module clones needed parts from that OriginalCharacter to a StarterCharacter to be used by the player.

Relevant part of that section:

local ReferenceCharacter = PlayerCache:FindFirstChild("OriginalCharacter")

if ReferenceCharacter:FindFirstChild("Pants") then
	local pantsClone = ReferenceCharacter.Pants:Clone()
	pantsClone.Parent = StarterCharacterClone
	warn("Pants not found", player)

While testing in Roblox I sometimes get the warning “Pants not found.”

I have tried everything I can think of. My latest attempt was to search Roblox and see how they are waiting for the appearance to load.

The wait for appearance (from Roblox sample) is from the Roblox documentation, but it does not fix the issue.

Any ideas on what I am doing wrong?


I patched the problem by:

repeat task.wait() until Player.Character:FindFirstChild("Pants")

But, does anyone know if Pants are part of every Roblox character?

Pants are not a part of every Roblox character, they are equipped voluntarily in the avatar selection.

1 Like

Figured out the problem.

I was not letting the character fully spawn into the workspace.

Even though Roblox says the character appearance has loaded, apparently it is not really true until the character actually spawns.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.