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 format for saving tables in DataStores?

Hi everyone, I'm currently working on a perm ban system using DataStores. For this to work efficiently, it needs tables. I don't know what is the correct format to create tables in DataStores. Do I just make up the table name and it will appear?

Here is some example code

store:GetAsync(key, table.insert([TABLE NAME HERE], id)

1 answer

store:SetAsync("TableName",{})

this would create a blank table in a datastore

6 comments

0

How would I add values to the table then?

0

put the values in {}

0

Yes, but it gets added in-game, meaning it would have to be table.insert() or something.

0

then use getasync(),insert it, and save it back the the datastore

0

store:SetAsync("BanTable", add) add is the table.insert(), it comes out with argument 2 missing.

0

In this situation, you'd want to use :UpdateAsync() as there is potential for it to be changed by multiple servers. With it, check if an old value is there, and call table.insert(THE_TABLE, NEW_BANNED_PLAYER) on it.

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