Module Script Returning Nil Instead of Table

I’m having some problems getting a certain value from a modulescript. I’ve used them before and I’m not sure why this is not working. Any help?

Module:

local module = {}
Configs = {
  Yes = nil,
  No = nil,
  Webhook = ""
}
UserIds = {
  [202696816] = {Level = 1},
  [1234] = {Level = 2},
  [123456] = {Level = 3},
}
GroupIds = {
  [232223] = {Rank = 255, Level = 2},
  [239939] = {Rank = 2, Level = 1},
}
return module

Script:

    local config = require(script.Config)
	for i,v in pairs(config.UserIds) do
		if Player.UserId == v then
			local AdminLevel = Player:WaitForChild("AdminLevel")
			AdminLevel.Value = v.Level
		end
	end

Error:

15:54:35.701 - ServerScriptService.AdminServer.Modules.Functions:16: bad argument #1 to 'pairs' (table expected, got nil)

Thanks.

You need to insert the Configs, UserIds, and GroupIds tables into the module table that is being returned if you want to reference them from other scripts.

Just change the table names from:

Configs = {}

to:

module.Configs = {}

and you should be good.

3 Likes

Ohh- alrighty. Thanks for the help!

1 Like