Strange error? Module is nil all of the sudden even tho it isnt

  1. What do you want to achieve?
    I want to grab info from a moduleScript and use it.
  2. What is the issue?
    I keep getting this error
    Players.cakeycocoa.PlayerGui.Computer.bg.Desktop.AppGUIs.Ropera.urlManager:27: invalid argument #2 (string expected, got nil) - Client - urlManager:27
    It says that this variable in the module script is nil even tho it isnt???
  3. What solutions have you tried so far?
    I asked on discord bc I have no idea what to even google for this.
local urls = script.Parent.Webs
local web = require(game:GetService("ReplicatedStorage"):WaitForChild("ModuleScripts").Websites)
local Sites = script.Parent.Webs
local searchBox = script.Parent.topBar.url

local currentSiteIndex = 1

local function loadSite(frameName)
	
	local webIndex

	for index, value in pairs(web.frameName) do -- looks for the right index
		if value == frameName then
			webIndex = index
			break
		end
	end
	
	if not web.isOpen[webIndex] then -- if site is open it will continue, else it will not
		Sites.NoWebFound.Visible = true
		return
	else
		Sites.NoWebFound.Visible = false
	end
	
	Sites[web.frameName[webIndex]].Visible = true
	Sites[web.frameName[currentSiteIndex]].Visible = false -- error is this line
	
	searchBox.Text = web.urlStart..web.urls[webIndex]..web.urlEnd
	currentSiteIndex = webIndex
end



Sites.RoperaWiki.websScrolling.Mancante.gateway.Activated:Connect(function()	
	loadSite("Mancante")
end)

Module Script

local module = {
	
	urlStart = "http://",
	urlEnd = ".acn",
	
	urls = {
		
		TheRoperaWikiI = "dd7hrne0204dmw12eo91",
		Mancante = "da673a8284e22ke239ca2",
		
	},
	
	siteNames = {
		
		TheRoperaWikiI = "The Ropera Wiki I",
		Mancante = "Mancante"
		
	},
	
	siteDescriptions = {
		
		TheRoperaWikiI = "The starting place to anyone who ventures into the dark side of Ropera.",
		Mancante = "The starting place to anyone who ventures into the dark side of Ropera."
		
	},
	
	locations = {
		
		TheRoperaWikiI = "Given by Cakeycocoa",
		Mancante = "Found in The Ropera Wiki I"
		
	},
	
	isOpen = {
		
		TheRoperaWikiI = true,
		Mancante = true
		
	},
	
	frameName = {
		
		TheRoperaWikiI = "RoperaWiki",
		Mancante = "Mancante"
		
	}
}

return module

I believe your issue is that you’re trying to index a number into a dictionary. Essentially, your code is doing this:

frameName[1]

Which won’t exist in a dictionary. (currentSiteIndex) is initially defined as 1

I guess ill use a for loop to disable all the gui’s.

(worked)