plr.CharacterAppearanceLoaded:Wait() not working

--checking if character has loaded
	local loaded = plr:HasAppearanceLoaded()
	
	if loaded then
	else
		plr.CharacterAppearanceLoaded:Wait()
	end

My script here is supposed to wait until the player has loaded.
I have a script below it that destroys certain accessories/clothing on the player before adding new ones. There’s a print statement for every child it loops through- For my character, there is 22.
Every time I first spawn in, this works perfectly. 22 loops.
But then when I die and respawn, only 16, and NONE of the accessories are destroyed.

This shouldn’t be happening, because I waited for the character appearance to be loaded, right…? Help…

2 Likes

From the Wiki Page it states:

;This is useful when determining whether a player’s appearance has loaded after they first join the game, which can be tracked using the Players.PlayerAdded event.;

https://create.roblox.com/docs/reference/engine/classes/Player#HasAppearanceLoaded

So I believe it returns true, and then is never false again based on when it says ‘after they first join the game’

ok, then why doesn’t replacing this

with this

work?

It might have already fired, you might have to use variables and set it to true whenever it fires, and false when the player dies.

Wdym already fired, like before the line is reached, meaning it’s constantly waiting for plr.CharacterAppearanceLoaded to be fired but never will since it already has?

Yep. If it has already fired, then it’ll yield infinitely.

The local script that fires this remote event when the character is added- I just put the CharacterAppearanceLoaded:Wait() there before calling the remote event, which seems to be consistent, as it is DIRECTLY after characterAdded() fires so I guess there’s less delay

2 Likes