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.

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)
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?

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)
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