How do I use a value from a table, within the table?

  1. What do you want to achieve?
    I want to use a variable that I set in this table, in another portion of the table.

  2. What is the issue?
    The issue is that there is an unknown global “PoliceSystem”, when I try this:
    local PlayerSelectorMenuObjectClone = PoliceSystem.Objects.PlayerSelectorMenuObject:Clone()

  3. What solutions have you tried so far?
    I’ve looked on the DevForum to see if people had the same issue as me, but nobody seems to have similar issues.

local PoliceSystem = {
	
	["Settings"] = {
		DeveloperMode = true, -- Leave as "false" at all times unless testing in studio!
		ArrestDetainEvaders = true,
	},
	
	["Objects"] = {
		-- GUIs
		PlayerDetaineeObject = script.Parent.DetaineeGUI,
		PlayerSelectorMenuObject = script.Parent.SelectedPlayerGUI,
		PlayerArrestedObject = script.Parent.ArrestedGUI,
		
		-- Scripts
		PoliceSystemManager = script,
		PlayerSelectorScript = script.Parent.PlayerSelector,
		PoliceSystemEventHandlerScript = script.Parent.PoliceSystemEventHandler,
		
		-- Events
		PoliceSystemEvent = script.Parent.PoliceSystemEvent
	},	
	
	["Logging"] = {
		DetainEvaderArrestTime = 900,
		DetainEvaderArrestingOfficer = "Server"
	},
	
	["Access"] = {
		["Teams"] = {
			["Police"] = Teams["Military Police"],
			["Headquarters"] = Teams["Marine Headquarters"]
		},
		
		["Groups"] = {
			["MPC"] = {
				["GroupID"] = 17023204,
				["RequiredGroupRank"] = 1
			},
			
			["Headquarters"] = {
				["GroupID"] = 32726961,
				["RequiredGroupRank"] = 1
			}
		},
		
		["Users"] = {
			["TooLongIdling"] = 52381317,
		}
	},
	
	["Functions"] = {
		["PlayerSelection"] = function(player, argument_1)
			if argument_1 == nil then
				if Players[player].PlayerGui.PlayerSelectorMenuObject then
					Players[player].PlayerGui.PlayerSelectorMenuObject:Destroy()
				end
			else
				if not Players[player].PlayerGui.PlayerSelectorMenuObject then
					local PlayerSelectorMenuObjectClone = PoliceSystem.Objects.PlayerSelectorMenuObject:Clone()
				end
			end
		end,
		["Detaining"] = function(player, argument_1)
			
		end,
		["Arresting"] = function(player, argument_1)
			
		end,
	}
}

return PoliceSystem

To get the table in a table do this:

TheTable[TableInATable]

Hey, thanks for your response. However, we’ll need the table to be recognized first. When I do PoliceSystem[], it’s still not recognized. For your information, this is in a ModuleScript.

just do

local Table = require(Table)

print(Table[Settings]) -- or just replace the Settings bit with the location