It only looks for the pants if it finds the shirt, add a 2nd end to the shirt if statement:
if Player.Character:FindFirstChildOfClass("Shirt") and Player.Character:FindFirstChildOfClass("Pants") then
if Player.UserId and PFolder.Name then
SD.ShirtTemplate = CharacterModel.Shirt.ShirtTemplate
Player.Character.Shirt.ShirtTemplate = SD.ShirtTemplate
end
end
if CharacterModel:FindFirstChildOfClass("Pants") then
if Player.UserId == PFolder.Name then
PD.PantsTemplate = CharacterModel.Pants.PantsTemplate
Player.Character.Pants.PantsTemplate = PD.PantsTemplate
end
end
Right, but things like noob avatars could simply not want to wear pants, so ignoring the thing if they don’t have both things is straight up unjustified and possibly annoying to players.
local NFolder = Instance.new('Folder', game.ReplicatedStorage)
NFolder.Name = 'CharDataBase'
game.Players.PlayerAdded:Connect(function(Player)
local PFolder = Instance.new('Folder', NFolder)
local SD = Instance.new('Shirt', PFolder)
local PD = Instance.new('Pants', PFolder)
PFolder.Name = Player.UserId
SD.Name = 'Shirt'
PD.Name = 'Pants'
local FoundCharacter, CharacterModel = pcall(function()
return game.Players:GetCharacterAppearanceAsync(Player.UserId)
end)
if CharacterModel:FindFirstChildOfClass('Shirt') ~= nil then
if Player.UserId and PFolder.Name then
SD.ShirtTemplate = CharacterModel.Shirt.ShirtTemplate
Player.Character.Shirt.ShirtTemplate = SD.ShirtTemplate
end
end
if CharacterModel:FindFirstChildOfClass('Pants') ~= nil then
if Player.UserId == PFolder.Name then
PD.PantsTemplate = CharacterModel.Pants.PantsTemplate
Player.Character.Pants.PantsTemplate = PD.PantsTemplate
end
end
end)
local NFolder = Instance.new('Folder', game.ReplicatedStorage)
NFolder.Name = 'CharDataBase'
game.Players.PlayerAdded:Connect(function(Player)
local PFolder = Instance.new('Folder', NFolder)
local SD = Instance.new('Shirt', PFolder)
local PD = Instance.new('Pants', PFolder)
PFolder.Name = Player.UserId
SD.Name = 'Shirt'
PD.Name = 'Pants'
local FoundCharacter, CharacterModel = pcall(function()
return game.Players:GetCharacterAppearanceAsync(Player.UserId)
end)
if CharacterModel:FindFirstChildOfClass('Shirt') ~= nil then
if Player.UserId and PFolder.Name then
SD.ShirtTemplate = CharacterModel.Shirt.ShirtTemplate
Player.Character.Shirt.ShirtTemplate = SD.ShirtTemplate
end
end
if CharacterModel:FindFirstChildOfClass('Pants') ~= nil then
if Player.UserId == PFolder.Name then
PD.PantsTemplate = CharacterModel.Pants.PantsTemplate
Player.Character.Pants.PantsTemplate = PD.PantsTemplate
end
end
if CharacterModel:FindFirstChildOfClass('ShirtGraphic') ~= nil then
if Player.UserId == PFolder.Name then
PD.TShirtGraphic = CharacterModel.ShirtGraphic.Graphic
Player.Character.ShirtGraphic.Graphic = PD.TShirtGraphic
end
end
end)
If you haven’t heard about HumanoidDescription, you might wanna check this out because this is what I use for Applying Clothes to Players. From there, you can change Accessories, T-Shirts, Shirts, Character Scaling, Animations, Body Colors.
I’m making a custom code for it cause I’m making something like a R6 height system. And I don’t think humanoid desc supports R6 Sizing using the Y Size