Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Cloning players clothes to a custom character model?

Asked by 6 years ago
Edited 6 years ago

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.

01local PS = game:GetService("Players")
02 
03game.Players.PlayerAdded:Connect(function(player)
04local info = game:GetService("Players"):GetCharacterAppearanceInfoAsync(player.UserId) -- get a table with information about the user's worn assets. takes an user id.
05 
06local 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
14end
15 
16printTable(info)
17end)
0
You could always just clone the items and paste them into the start character? CrazyCorrs 98 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Is this what you're looking for?

01game.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)
17end)
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! XxTGLxX 7 — 6y
Ad

Answer this question