Maybe try parenting the clothes to something else (i.e the script itself) then back to the character? Maybe they just needed to be reloaded. It’s also possible that the ROBLOX asset delivery servers were wonky right then.
You have to use ‘free use’ items. I think you can also use ones you own.
I know not all are free to use, these work…
local shirtIDs = {
"3670737337"
}
local pantsIDs = {
"144076759"
}
local shirt = script.Parent.Shirt
local pants = script.Parent.Pants
local shirtSelected = shirtIDs[math.random(1, #shirtIDs)]
local pantsSelected = pantsIDs[math.random(1, #pantsIDs)] --0 would = nil
shirt.ShirtTemplate = "rbxassetid://"..shirtSelected
pants.PantsTemplate = "rbxassetid://"..pantsSelected --this is already a string
If those two are not working, I think I own them… They work for me.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local function createClothing()
local shirt
local pants
local shirtIDs = {
"11939149226",
"12194571961",
"6668635237",
"17205592737"
}
local pantsIDs = {
"11939157230",
"11942062856",
"6669511764",
"11942062856"
}
if character:FindFirstChild("Shirt") then
print("Shirt found")
elseif character:FindFirstChild("Pants") then
print("Pants found")
else
shirt = Instance.new("Shirt", character)
pants = Instance.new("Pants", character)
shirt.Name = "Shirt"
pants.Name = "Pants"
end
local shirtSelected = shirtIDs[math.random(1, #shirtIDs)]
local pantsSelected = pantsIDs[math.random(1, #pantsIDs)]
return shirtSelected, pantsSelected
end
local function applyAppearance()
local shirtId, pantsId = createClothing()
local humanoid = character:WaitForChild("Humanoid")
local appearance = humanoid:GetAppliedDescription()
appearance.Shirt = tonumber(shirtId)
appearance.Pants = tonumber(pantsId)
humanoid:ApplyDescription(appearance)
end
applyAppearance()
end)
end)
Add this to serverscriptservice. It should do the trick, I tested it in studio.