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)
