How to detect if an imported character model has fully loaded

so i have a system that takes a random player’s friend character and then loads it in,

but i cant find a way to check if that character has loaded, if you want to do it for the player playing’s character then you just use “CharacterAppearanceLoaded”, but i cant because you need to get the player in order to run this variable or function,

so any help will be appreciated

heres the script (server script) :

local Players = game:GetService("Players")

local function iterPageItems(pages)
	return coroutine.wrap(function()
		local pagenum = 1
		while true do
			for _, item in ipairs(pages:GetCurrentPage()) do
				coroutine.yield(item, pagenum)
			if pages.IsFinished then
			pagenum = pagenum + 1

local userId = Players:GetUserIdFromNameAsync(plr.Name)
local friendPages = Players:GetFriendsAsync(userId)

local Friends = {}
for item, _pageNo in iterPageItems(friendPages) do
	table.insert(Friends, item.Username)

local FriendName = Friends[math.random(1, #Friends)]
local FriendUserId = Players:GetUserIdFromNameAsync(FriendName)

local FriendChar = Players:CreateHumanoidModelFromUserId(FriendUserId)
local FriendHumanoid:Humanoid = FriendChar:FindFirstChildWhichIsA("Humanoid")
local FriendAnimator:Animator = FriendHumanoid:FindFirstChild("Animator")
local FriendRootPart:BasePart = FriendChar:FindFirstChild("HumanoidRootPart")	

FriendHumanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None

FriendChar.Parent = Cashier
FriendRootPart.CFrame = NpcStartPositioner.CFrame
 -- here is where i need to yeild the script until the friend character has loaded

local WalkAnim = game.ReplicatedStorage.Animations.NpcWalkAnim
local WalkTrack = FriendAnimator:LoadAnimation(WalkAnim)


Try: ContentProvider | Documentation - Roblox Creator Hub

I’m not sure how well this works for dynamically inserted models though!

1 Like

considering i cant delete this topic, and also that its just stupidly complicated, i just put a wait(0.8) and thats it, thanks for the help though

1 Like