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
I am not familiar with scripts, so an in-depth tutorial would be nice
I already have the custom character model. Its a basic r15 rig with all accessory attatchments.
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
-- 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)