Why does this work the first time but not after?

game.Players.LocalPlayer.CharacterAdded:Connect(function()
	
	game.ReplicatedStorage.clothesAndFootstepSoundAssigner:FireServer()
	
end)

This is in a local script in starterplayerscripts. It fires a remote event to add clothes, sound effects, and remove accessories of the player.

game.ReplicatedStorage.clothesAndFootstepSoundAssigner.OnServerEvent:Connect(function(plr)
	print("fired")

	local char = plr.Character

	repeat wait() until plr:HasAppearanceLoaded() == true

	--remove clothes
	for i, child in pairs(char:GetDescendants()) do
		print('doing thuis')
		if child:IsA("Shirt") or child:IsA("ShirtGraphic") or child:IsA("Pants") then
			child:Destroy()
		end



		--also, destroy any accessories that arent hair or hats
		if child:IsA("Accessory") then

			if child.AccessoryType ~= Enum.AccessoryType.Hat and child.AccessoryType ~= Enum.AccessoryType.Hair then
				child:Destroy()
			else
				--if it doesn't get destroyed, disable cantouch
				child.Handle.CanTouch = false
			end


		end
	end




	--add new ones
	local shirt = Instance.new("Shirt")
	shirt.ShirtTemplate = "rbxassetid://5262351881"
	shirt.Parent = char

	local pants = Instance.new("Pants")
	pants.PantsTemplate = "rbxassetid://1137160924"
	pants.Parent = char


	--insert torso footstep sound
	local sound = Instance.new("Sound")
	sound.Name = "footstep1"
	sound.Volume = .1
	sound.SoundId = "rbxassetid://6563562192"
	sound.Parent = char.Torso

	local sound = Instance.new("Sound")
	sound.Name = "footstep2"
	sound.Volume = .1
	sound.SoundId = "rbxassetid://6563562192"
	sound.Parent = char.Torso


	--insert torso crawl sound
	local sound = Instance.new("Sound")
	sound.Name = "crawl1"
	sound.Volume = 1
	sound.SoundId = "rbxassetid://9113702211"
	sound.Parent = char.Torso

	local sound = Instance.new("Sound")
	sound.Name = "crawl2"
	sound.Volume = 1
	sound.SoundId = "rbxassetid://9113702211"
	sound.Parent = char.Torso



end)

This is the remote event.
The top part is the most important, not the instancing of new clothes.

When I first load it, it prints “doing thius” (i spelled it wrong and cannot be bothered to fix it lol) 102 times. When I die and respawn, it does it 66 times. This leads me to believe that not all the parts of the character’s appearance have loaded in when it begins the script, DESPITE the repeat wait() at the start.
Does that mean the repeat wait() thing is actually working? Help

switched this for plr.CharacterAppearanceLoaded:Wait() and it works perfectly now

You shouldn’t be using a repeat wait loop for that.

Optimized code:

--//Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--//Variables
local LocalPlayer = Players.LocalPlayer
local RemoteEvent = ReplicatedStorage.clothesAndFootstepSoundAssigner

--//Functions
LocalPlayer.CharacterAdded:Connect(function()
	if not LocalPlayer:HasAppearanceLoaded() then
		LocalPlayer.CharacterAppearanceLoaded:Wait()
	end
	
	RemoteEvent:FireServer()
end)

yeah im not thats why i said i replaced it?
i didnt make it repeat wait() until plr.CharacterAppearanceLoaded or however youd format that
its just
plr.CharacterAppearanceLoaded:Wait()

Ohh, sorry I didn’t read it quite right.