Char Clothing Problem

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

I found out how to fix it. I just had to change one of the statements because I kept it as == and forgot to change it to and

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 and CharacterModel:FindFirstChildOfClass('Pants') ~= nil then
		if Player.UserId and PFolder.Name then
			SD.ShirtTemplate = CharacterModel.Shirt.ShirtTemplate
			Player.Character.Shirt.ShirtTemplate = SD.ShirtTemplate
			PD.PantsTemplate = CharacterModel.Pants.PantsTemplate
			Player.Character.Pants.PantsTemplate = PD.PantsTemplate
		end
	end
end)

If player wears no pants that ain’t going to work (No clue why I deleted this one)

Then they will be ignored for being half nude.

Roblox automatically applies clothing to your avatar if you are missing clothes

Only if you’re using the same skin tone.

For some reason now my char can’t move

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.

I don’t think changing a shirt ID can cause a character to not move, it’s either other script or a roblox player bug

I know but you could just kick nude players for being naughty.

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

Here’s added support for t-shirts.

My character can’t walk though

Likely some other script/plugin as someone else suggested.

nvm its a studio think ill fix it later

Real quick how can I support accessories

for i, v in pairs(CharacterModel:GetChildren()) do
	if v:IsA("Accessory") then
		--do something with the accessory
	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