Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Get A Table In A ModuleScript?

This Is The Code

local Admins = {"Player1","Filipalla","Builderman"}
return Admins
local module = require(game.ServerStorage.AdminTestModule)
print(module.Admins)

it returns nil! can i use a variable like this to get what is in the table?

Admins = module.Admins

1 answer

✓ Accepted answer

The first script returns a table so the variable on the second script the variable module will have a table, as the table returned does not have a 'Admins' key then the result is nil.

Module script:-

return {"Player1","Filipalla","Builderman"} -- as we don't need to use the variable just return the table to use

script:-

for _, admin in pairs(require([location of module scrip]) do
	print(admin)
end

This is just an example as you have not added any info about what this is needed for.

2 comments

0

it is needed for an admin script

0

This example should be ok but you should be using UserId and not the player name.

This discussion is preserved as it was. New answers, comments, and votes are closed.