Need help with equipping shirts and stuff [Closed]

Hello I was trying to make this script to equip accessories and yes they do get equipped but the thing is that it doesn’t delete the accessories already in the player so multiple accessories are in the player. As you can see in the script the for i loop doesn’t delete it but i cannot find an alternative and i even tried findfirstchild and destroy() but destroy comes up as nil. I have no idea what to do and need help.

local events = game.ReplicatedStorage.Events.Customize
events.OnServerEvent:Connect(function(player,name,category)
	if category == "Hair" then
		local clone = game.ReplicatedStorage.Customization[category][name]:Clone()
		for i,v in pairs(player:GetDescendants()) do
			if v:IsA("Accessory") then
				v:Destroy()
			end
		end
		player.Character.Humanoid:AddAccessory(clone)
	end
	
	if category == "Shirts" then
		local clone = game.ReplicatedStorage.Customization[category][name]:Clone()
		for i,v in pairs(player:GetDescendants()) do
			if v:IsA("Shirt") then
				v:Destroy()
			end
		end
		clone.Parent = player.Character
	end
	
	if category == "Pants" then
		local clone = game.ReplicatedStorage.Customization[category][name]:Clone()
		for i,v in pairs(player:GetDescendants()) do
			if v:IsA("Pants") then
				v:Destroy()
			end
		end
		clone.Parent = player.Character
	end
	
	if category == "Hats" then
		local clone = game.ReplicatedStorage.Customization[category][name]:Clone()
		for i,v in pairs(player:GetDescendants()) do
			if v:IsA("Hat") then
				v:Destroy()
			end
		end
		player.Character.Humanoid:AddAccessory(clone)
	end
end)

This line would not work, hats are also classified as an accessory. Replace it with:

if v:IsA("Accessory") then

If you want hair to be able to stack hair with hats, accessories have a property called AccessoryType. You can check this, only delete the accessory if the AccessoryType is equal to Hat or Hair.

nvm guys i fixed it by doing player.Character.Humanoid:RemoveAccessories()
thanks for the help