game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Shirt = Character:FindFirstChildWhichIsA("Shirt")
--and do the same for pants
end)
end)
Beware that this could return nil if there are no clothing, more shirts.
Method #1:
Clone the player’s clothes into a folder or save the player’s clothes ID when a player joins the game, so you can retrieve it when needed.
Method #2: GetCharacterAppearanceInfoAsync
This will return a table with what the player is currently wearing:
local ShirtTable = game.Players:GetCharacterAppearanceInfoAsync(Player.UserId)
for i, val in pairs(ShirtTable["assets"]) do
if ShirtTable["assets"][i]["assetType"]["name"] == "Shirt" then
local InstanceShirt = Instance.new("Shirt")
InstanceShirt.Name = "Shirt"
InstanceShirt.ShirtTemplate = InsertService:LoadAsset(ShirtTable["assets"][i]["id"]):GetChildren()[1].ShirtTemplate
InstanceShirt.Parent = Character
elseif ShirtTable["assets"][i]["assetType"]["name"] == "Pants" then
local InstanceShirt = Instance.new("Pants")
InstanceShirt.Name = "Pants"
InstanceShirt.PantsTemplate = InsertService:LoadAsset(ShirtTable["assets"][i]["id"]):GetChildren()[1].PantsTemplate
InstanceShirt.Parent = Character
end
end