Custom character with player accessories

hello I need help with a game i’m making and it requires a system that gets the players’ accessories and inserts them into my starter/custom character

  1. I am not familiar with scripts, so an in-depth tutorial would be nice

  2. I already have the custom character model. Its a basic r15 rig with all accessory attatchments.

  3. I’ve tried some other scripts, but they only work for single player. I want the script to apply to all players and the accessories are inserted to the original player after the custom character loads

Here is the script:

-- Server

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(plr)
	local char = plr.Character or plr.CharacterAdded:Wait()
	local UserID = plr.UserId
	local appearance = Players:GetCharacterAppearanceAsync(UserID)

	-- Check if the player's character is already loaded
	if char then
		-- Apply the character appearance to the hair
		for _, item in ipairs(appearance:GetChildren()) do
			local itemClone = item:Clone()
			itemClone.Parent = char
		end
	else
		-- If the character is not yet loaded, wait for it to load
		char = plr.CharacterAdded:Wait()
		for _, item in ipairs(appearance:GetChildren()) do
			local itemClone = item:Clone()
			itemClone.Parent = char
		end
	end
end)

Or if you want to make clothes load after player dies, here is another script:

local Players = game:GetService("Players")

local function applyAppearance(plr)
	local UserID = plr.UserId
	local appearance = Players:GetCharacterAppearanceAsync(UserID)

	-- Wait for the character to be fully loaded
	local char = plr.Character or plr.CharacterAdded:Wait()
	char:WaitForChild("Humanoid") -- Ensure Humanoid is loaded

	-- Apply the character appearance
	for _, item in ipairs(appearance:GetChildren()) do
		local itemClone = item:Clone()
		itemClone.Parent = char
	end
end

Players.PlayerAdded:Connect(function(plr)
	-- Apply appearance when player joins
	plr.CharacterAdded:Connect(function()
		applyAppearance(plr)
	end)
end)

May i ask where the custom charactdr is?
I have the model tho. If i wasnt clear enough, i have the starter character

You mean where starterCharacter should be?

Yes i think thats what im confused os

Place it in the StarterPlayer:

Screenshot 2024-05-26 134754

The name must be “StarterCharacter”

Its working, but i actually need the accessories to be meshparts, something that only r15 rigs have

at this point i’m wondering if anyone will ever respond