Shirt/Pants Command Makes Player Nude

So… I honestly, don’t know what to do from here.

I have made many attempts to make commands for shirts and pants, and the only way to make the shirts and pants work, is by manually doing it in studio, and configuring the ID inside the script.

What I am trying to achieve - Player types /shirt or /pants with an ID, it grabs ID from catalog, and places that onto the character.

Script works perfectly, just confused with this bug.

game.Players.PlayerAdded:Connect(function(player) 				-- When they join
	player.CharacterAppearanceLoaded:Connect(function(char) 	-- When their character loads
		player.Chatted:Connect(function(message)				-- When they chat
			
			if player:IsInGroup(GroupID) then 					-- We check if their in group
				
				local lower = message:lower() 					-- Getting the message lower
				local args = lower:split(" ")					-- Splitting the message
			
				--[ UNIFORM COMMAND ]--
				
				if args[1] == Prefix.. "shirt" then 			-- Checking if they did /shirt ____
					local shirtID = args[2]
					local Shirt = char:FindFirstChild("Shirt")			-- FINDING SHIRT
					if Shirt then
						Shirt.ShirtTemplate = "rbxassetid://"..shirtID				-- CHANGING SHIRT
					end
				elseif args[1] == Prefix.. "pants" then         -- Checking if they did /pants _____
					local pantsID = args[2]
					local Pants = char:FindFirstChild("Pants")			-- FINDING PANTS
					if Pants then
						Pants.PantsTemplate = "rbxassetid://"..pantsID				-- CHANGING PANTS
					end
				end
			
			else
				print("Not In Group")							-- Letting us know their not in group
			end
			
		end)
	end)
end)

NOTE : Many developers have encountered this, though I have not found an answer. Anyone understand why this is happening?

2 Likes

The Catalog ID and the “rbxassetid://” are different. You will need to find the Asset ID from the Catalog ID. There was a similar post to this a while back, I’m sure they used InsertService:LoadAsset() to convert the Catalog ID to Asset ID.

Edit: Link to post -

2 Likes

Thank you for that, just figured something out!

if args[1] == Prefix.. "shirt" then 			-- Checking if they did /shirt ____
					local shirtID = args[2]
					
					local desc = Humanoid:GetAppliedDescription() 
					desc.Shirt = shirtID
					Humanoid:ApplyDescription(desc)
					
				elseif args[1] == Prefix.. "pants" then         -- Checking if they did /pants _____
					local pantsID = args[2]
					
					local desc = Humanoid:GetAppliedDescription() 
					desc.Pants = pantsID
					Humanoid:ApplyDescription(desc)
				end
2 Likes