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.
01 | local PS = game:GetService( "Players" ) |
02 |
03 | game.Players.PlayerAdded:Connect( function (player) |
04 | local info = game:GetService( "Players" ):GetCharacterAppearanceInfoAsync(player.UserId) -- get a table with information about the user's worn assets. takes an user id. |
05 |
06 | local function printTable(t, indent) -- recursively scans the table and prints it |
07 | indent = indent or "" |
08 | for k, v in next , t do |
09 | print (indent .. k, "=" , v) |
10 | if type (v) = = "table" then |
11 | printTable(v, indent .. ">" ) |
12 | end |
13 | end |
14 | end |
15 |
16 | printTable(info) |
17 | end ) |
Is this what you're looking for?
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | player.CharacterAdded:Connect( function (char) |
03 | wait( 0.5 ) |
04 | local starterchar = workspace.StarterCharacter |
05 | local descendants = char:GetDescendants() |
06 | for index, descendant in pairs (descendants) do |
07 | if descendant:IsA( "Accessory" ) then |
08 | local clone = descendant:Clone() |
09 | clone.Parent = starterchar |
10 | end |
11 | end |
12 | char:WaitForChild( "Pants" ):Clone().Parent = starterchar |
13 | char:WaitForChild( "Shirt" ):Clone().Parent = starterchar |
14 | char:WaitForChild( "Body Colors" ).Parent = starterchar |
15 | char.Head:WaitForChild( "face" ):Clone().Parent = starterchar.Head |
16 | end ) |
17 | end ) |