How can i check if the id is for a shirt?

I made this script but if i put a pants id instead shirt id it removes the shirt. is there a way to check if the id is for a shirt or something?

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ClientFolder = ReplicatedStorage:WaitForChild("Client")
local AddClothesFolder = ClientFolder:WaitForChild("AddClothes")
local ClothesAdder = AddClothesFolder:WaitForChild("ClothesAdder")

ClothesAdder.OnServerEvent:Connect(function(Client, Function, ShirtId)
	if Function == "SetClothes" then
		local Character = Client.Character
		local SetClothes
		local IsValid, Error = pcall(function()
			SetClothes = game:GetService("InsertService"):LoadAsset(ShirtId)
		end)
		if IsValid then
			if Character:FindFirstChildOfClass("Shirt") then
				Character.Shirt:Remove()
			end
			SetClothes.Shirt.Parent = Character
		end
	end
end)
1 Like

If I’m not mistaken, you could use the
https://developer.roblox.com/en-us/api-reference/function/MarketplaceService/GetProductInfo
to get the assettypeid

2 Likes