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

What is the best way to store a table?

Hey Everyone! I was working on a game, and I wanted to store a table like this in a value:

{true,false,false,false,false,false}

I tried storing it in a String Value but it said it was not a string. What is the best way to store this so I can get the data inside by just doing:

data.Value[1]

I also need to be able to edit this value from the script, and to check if it is changed.

It would be amazing if you could help with this!

Thanks, Armacom03

1 answer

Use a ModuleScript:

local module = {true,false,false,false,false,false}

return module

Now another script can use the info with the require function:

local data = require(game.ReplicatedStorage.ModuleScript)
print(data[1])

10 comments

1

How do I set the module script's text with the other script?

0

NO WAY GOULSTEMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

0

I missed you dude :o

0

Would I just do ModuleScript.module = {true,false,false,false,false,false}?

0

@armacom03 Simply data[index] = value

0

@greatneil <3 <3

0

no heart for me or what are u kidding me

0

@Goulstem I still don't understand. How would I format that code? And how would I change it from another script?

0

@Goulstem I get the error data is not a valid member of ModuleScript

0

@Goulstem Nevermind, I got it, but how would I detect if it's changed, like how you can do that with a value?

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