Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it possible to access a table without it being in the game?

Asked by 7 years ago

It's hard to explain. It's like a Module Script, where you can access it without it actually being in the game. However in this case, I am wondering if there is a method of accessing a table (maybe even using a Module if possible) without it being in the game. I want this for private settings that only I can change.

0
Can you really explain what you really want to be able to do? http://xyproblem.info/ Your question doesn't make sense BlueTaslem 18071 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Ok so I have personally never done this but I believe this is how it works. So you should run the Require function. The way it works is you make a Module script. Then you by calling that you can access a module script. you can do it with:

require(game.workspace.ModuleScript)

-- or

require("Asset Id") -- I am going to talk more about this near the end. This is the one you want.

There is a second function called return. This will send information back to your script. For example a table. So in the Module script you would type:

return { Value = 0 }

So there is an example of what a table would be like. Now in your script you would do:

local module = require(game.workspace.ModuleScript)
print(module.Value)
module.Value = module.Value + 1

That will print 1. If you put it in a for loop it will print 1 then 2 then 3 then 4, etc. Now for the final thing you want. For no one else to be able to access your module script. So make your module script then select it and publish the script making it a Free Model(It doesn't actually have to be for sale). Then you want to copy your asset ID and like it said way at the beginning you do:

require("The asset ID you copied")

--For example, lets say our module script is the example script above with the table and our id is 78623594, we would do

local module = require(78623594)
print(module.Value)
module.Value = module.Value + 1

There! So now that our module script is a model online you can delete it from your workspace! :D. This is my first answer that I have really worked hard on so thanks for reading! :D If you have any questions please comment below and let me know if this helped. :D

0
So in my case, I would like to make a table of admins. In the main server script, it uses a 'for' loop to search through the table and find the player. How would I be able to do this? UltimateGameCreator1 38 — 7y
0
How would I search through that kind of table using a 'for' loop in a server script? UltimateGameCreator1 38 — 7y
Ad

Answer this question