Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Cloning players clothes to a custom character model?

So i have a StarterCharacter and i want to clone the players clothes to the StarterCharacter. i have a script which shows me the clothing items and their id's but i dont know how to grab them in the script just through the output. Here is the script and what it outputs.

local PS = game:GetService("Players")

game.Players.PlayerAdded:Connect(function(player)
local info = game:GetService("Players"):GetCharacterAppearanceInfoAsync(player.UserId) -- get a table with information about the user's worn assets. takes an user id.

local function printTable(t, indent) -- recursively scans the table and prints it
	indent = indent or ""
	for k, v in next, t do
		print(indent .. k, "=", v)
		if type(v) == "table" then
			printTable(v, indent .. ">")
		end
	end
end

printTable(info)
end)

1 comment

0

You could always just clone the items and paste them into the start character?

1 answer

Is this what you're looking for?

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		wait(0.5)
		local starterchar = workspace.StarterCharacter
		local descendants = char:GetDescendants()
		for index, descendant in pairs(descendants) do
			if descendant:IsA("Accessory") then
				local clone = descendant:Clone()
				clone.Parent = starterchar
			end
		end
		char:WaitForChild("Pants"):Clone().Parent = starterchar
		char:WaitForChild("Shirt"):Clone().Parent = starterchar
		char:WaitForChild("Body Colors").Parent = starterchar
		char.Head:WaitForChild("face"):Clone().Parent = starterchar.Head
	end)
end)

1 comment

0

well yes but i was trying to work my way around having to manually change the player model to a custom model but i guess ill just script it thanks though!

This discussion is preserved as it was. New answers, comments, and votes are closed.