Trying to wait for all accessories in a character

Hey there! i want to have a viewport frame with ur current character on the bottom of the screen by cloning the player’s FULLY loaded character (accessories included!) every time their character loads in.
However, listening for CharacterAppearanceLoaded to run it doesnt seem to be enough, as it doesnt seem to take accessories into account, resulting in it sometimes cloning correctly into the viewport, and sometimes loading with no accessories, help would be appreciated!
Here’s the code

local players = game:GetService("Players");
local player:Player = players.LocalPlayer

local viewport = script.Parent;

local function clearViewport ()
	for _,child in viewport.WorldModel:GetChildren() do
		child:Destroy()
	end
end

local function setCharToAvatar (char) 
	clearViewport()
	local newChar:Model = player.Character:Clone()
	newChar.Parent = viewport.WorldModel
	newChar:PivotTo(CFrame.new(0,1.5,0))
end

player.CharacterAppearanceLoaded:Connect(function(char)
	char.Archivable = true
	setCharToAvatar(char)
end)



I’m not sure if this will wait for everything to be loaded like you want, but go ahead and give it a shot!

local localPlayer = playersService.LocalPlayer
local localCharacter = localPlayer.Character or localPlayer.CharacterAdded:wait()

I’m not 100% this will help, but there’s a HasAppearanceLoaded method of the Player object. It says it includes accessories in its factoring whether to return true or false.

Player # HasAppearanceLoaded | Documentation - Roblox Creator Hub

1 Like