-- A table to prevent users from equipping multiple clothing items that go in the same "slot". 

GroupedAccessoryTypes = {}
GroupedAccessoryTypes[1] = {
	Enum.AccessoryType.Pants, 
	Enum.AccessoryType.Shorts, 
	Enum.AccessoryType.DressSkirt,
	Enum.AccessoryType.Waist,
}
GroupedAccessoryTypes[2] = {
	Enum.AccessoryType.TShirt,
	Enum.AccessoryType.Shirt,
	Enum.AccessoryType.Sweater,
}

local function usesSameClothingSlot(accessoryTypeName1, accessoryTypeName2)
	local accessoryType1 = ACCESSORY_TYPE_BY_NAME[accessoryTypeName1]
	local accessoryType2 = ACCESSORY_TYPE_BY_NAME[accessoryTypeName2]

	if accessoryType1 == accessoryType2 then
		return true
	end

	local group1 = 0
	local group2 = 0
	for i, accessoryGroup in pairs(GroupedAccessoryTypes) do
		for _, accType in pairs(accessoryGroup) do
			if accessoryType1 == accType then
				group1 = i 
			end 

			if accessoryType2 == accType then
				group2 = i
			end
		end
	end

	if group1 == group2 and group1 ~= 0 then
		return true
	end

	return false
end

return usesSameClothingSlot
