Help me find the error

Hi DevForum

Could you please help me find the error?
I tried everything and still the same

ServerScriptService.SummonReset:66: attempt to compare number < nil - Server - SummonReset:66

local weights = {
	Common = 100,
	Uncommon = 35,
	Rare = 20,
	VeryRare = 10,
	Legendary = 1,
	Mythical = 0.1,
	Unseen = 0.01
}

local function getAvailableItems(day)
	local rng = Random.new(day)
	local shopItems = {}
	local selectedItems = {}

	local weightedItems = {}

	for category, weight in pairs(weights) do
		local itemFolder = towers:FindFirstChild(category .. "Items")

		if itemFolder then
			local itemTable = itemFolder:GetChildren()

			for _, item in ipairs(itemTable) do
				table.insert(weightedItems, { item = item, weight = weight })
			end
		else
			warn("Folder not found: " .. category .. "Items")
		end
	end

	table.sort(weightedItems, function(a, b)
		return a.weight > b.weight
	end)

	while #shopItems < 6 do
		local item = nil

		for _, weightedItem in ipairs(weightedItems) do
			local category = weightedItem.item.Name
			local categoryWeight = rng:NextNumber(0, 100)

			if categoryWeight < weights[category] and not selectedItems[category] then
				item = weightedItem.item
				break
			end
		end

		if item and not selectedItems[item] then
			table.insert(shopItems, item.Name)
			selectedItems[item] = true
		end
	end

	return shopItems
end

Thank you for any help

Which line is line 66? Just saying that it’s gonna be hard for people to find the error if the line of code isn’t specified