Daily Shop Function not working

Hello, This function for my Daily Shop is not working, I have been trying to figure out the error for about 3 hours.

I believe its an issue with the ChancesTable.

Code:

function GenerateDailyShop()
	wait(math.random()* math.random(1,2))
	if ServerIsHandlingRequest == false then
		warn('[SHOP] Another server is tasked with refreshing the item shop.')
	else

		if game["Run Service"]:IsStudio() then
		else
			MessagingService:PublishAsync('GenerateDailyItems')
		end	
		
		local ShopStore = DataStoreService:GetDataStore('ShopData')
		local ShopData = {}
		
		
		local ChancesTable = {}
		
		local C = game.Lighting.Enchantment:GetChildren()
		for Index = 1,#C do
			for _ = 1,C[Index].Chance.Value do
				print('index 1')
				table.insert(ChancesTable,C[Index].Name)
			end
		end
		
			
		for _ = 1,#ChancesTable do
			local RandObject = math.random(1,#ChancesTable)
			if table.find(ShopData,ChancesTable[RandObject]) then
				
			else

				table.insert(ShopData,ChancesTable[RandObject])
				
				if #ShopData >= 4  then
					break
				end
			end
		end
		
		print(ShopData)
			
		






		ShopStore:SetAsync("TimeOnReset",os.time() + 3600)	
		ShopStore:SetAsync("ShopData",game.HttpService:JSONEncode(ShopData))	
	end
end
1 Like