This should have all the info you need.
Sorry I was asleep but that changes the shirt/pants template your supposed to put your templates instead of the strings there. Plus you put
local OriginalShirt = Character.Shirt.ShirtTemplate
local OriginalPants = Character.Pants.PantsTemplate
So i kept it there
This comment saved me from my suffering lol, I was trying to get a shirt to load on a player but apparently it wouldn’t load cause I was trying to set the id into it but that didn’t work for whatever reason, but if I use InsertService to directly get the shirt and use that, I don’t have to worry about that.
Hey! I may have found a solution to your problem.
local InsertService = game:GetService("InsertService")
local function replaceClothes(character: Model?, ShirtID: number, PantsID: number)
if character then
local shirt1 = character:FindFirstChildOfClass("Shirt")
if shirt1 then
shirt1:Destroy()
end
local pants1 = character:FindFirstChildOfClass("Pants")
if pants1 then
pants1:Destroy()
end
local success1, shirt = pcall(InsertService.LoadAsset, InsertService, ShirtID)
local success2, pants = pcall(InsertService.LoadAsset, InsertService, PantsID)
if success1 then
shirt:GetChildren()[1].Parent = character
shirt:Destroy()
end
if success2 then
pants:GetChildren()[1].Parent = character
pants:Destroy()
end
end
end
SuitUp.OnServerEvent:Connect(function(Player)
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Player.Character:FindFirstChild("Humanoid")
local ogShirtId = tonumber(string.match(Character.Shirt.ShirtTemplate, "%d+") or 0)
local ogPantsId = tonumber(string.match(Character.Pants.PantsTemplate, "%d+") or 0)
for _,v in pairs(Character:GetChildren()) do
if v:IsA("Accessory") and not v.Handle:FindFirstChild("HairAttachment")then
v.Handle.Transparency = 1
end
end
replaceClothes(Character, 3282533924, 19843664501)
end)
This should work for what you’re trying to do. Let me know if it doesn’t though!