Can you save tables?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

i want to know if u can save tables

  1. What is the issue? Include screenshots / videos if possible!

i try to make a amin sistem but i want to save it with tables not with boll values in player

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

i searched this on Developer Hub and Developer Forum but i don’t find something that can help me

oh and show me a line with how to save the table!

You can, it’s just this simple:
DS:SetAsync(key, {})

Advised to not use the example above as it is susceptible to data loss, this is a simple example.


Thanks :slight_smile: now i can create my own Admin sistem

1 Like

Simple Answer : Yes!

Full Answer: No,

You can’t save a Table but you can save other Data Types, such as Boolean, Number, Integer and String, etc

You can however convert a Table into a JSON string and Save it to Data Store, although this is done automatically so you don’t have to but be careful because it has limitations and special rules.

You can convert Array, and Dictionary with string keys

You can’t convert Array with gaps, Mixed - Table and Dictionary with non string keys

And no you cannot store other data types that I didn’t mentioned to DataStore, ie Instances, Vector3, CFrame, and Color3 but they can be converted to other data types as well.

but my script can save the table( somethimes have dataloss)

–// AdminTable \–

_G.Admins = {“pro_developer213”,“tudor22oi”}
_G.Banned = {“bananacool123rs”}

–// VerifyBann \–

local savebanns = game:GetService(“DataStoreService”)
local data = savebanns:GetDataStore(“Banns”)
local addata = savebanns:GetDataStore(“Admins”)

–// Custom function \–
local function Warn(WarnText)

local function Warn(PrintText)

local function Banned(Player,Time)
game.Players[Player]:Kick(“You has ben banned, wait “…Time…” to get unbanned!”)

local function BannedKick(Player,Time)
game.Players[Player]:Kick(“You has ben banned, wait “…Time…” to get unbanned!”)

local function Kick(Player,AdminName)
game.Players[Player]:Kick(“You has ben kicked by “…AdminName…” if u want to raport he, text at me with his name and what he do”)

–// Sistem \–
if not table.find(_G.Admins, plr.Name) and table.find(_G.Banned, plr.Name) then
BannedKick(plr, game.ReplicatedStorage.RecentTime.Value)

while wait() do
data:SetAsync(“Banns”, _G.Banned)

while wait() do
addata:SetAsync(“Admins”, _G.Admins)

For some reason I could save a table, what are you talking about? The table’s content was consistent every time i loaded. I am confused about why you think that you can’t save a table.

You mustn't have interpreted my reply correctly;

It can’t be saved directly as a Table but Roblox automatically converts it into a JSON string for you, so you don’t have to do it yourself, henceforth removing complexity for newbies while using DataStoreService.

(anything sent to Datastore will be converted to a JSON string, anything retrieved from DataStore will be converted back into it’s original form through the usage of JSONEncode and JSONDecode)

I did save a table without turning it into a JSON string. :man_facepalming:

The returned content is a table when loading it, and the JSON thing is trivial and non-related to the simple answer of the question.

1 Like

Yeah, I’m pretty sure that is normal, I’m not sure what @RuizuKun_Dev is talking about.

Every game I have made in the past 2 years has saved its contents in a table. I did later convert to JSON due to the fact that it uses less space, but I used regular tables for a long time before that.

You misinterpreted what he was saying even after he explained it again in pretty clear wording. He is saying technically a table is not stored, a string is stored with JSON. The actual table and its binary representation are not stored. I believe HttpService:JSONEncode/Decode are called internally or at least the same libraries behind them are used on the server. He is not saying “you have to convert it to JSON” he is saying “it is always converted to json.”

For users looking for this information who may be storing more data than a few strings and need to keep things low on size, I would actually really recommend storing tables in a custom data format instead of JSON. JSON can be rather clunky in size due to its syntax/readability which can increase the stored size of the data.


Wait, what key means?
I need to know what key means

DataStore keys are like table keys. They define a certain string for which you later perform lookups under. Think of DataStores like a very big table (well, they actually are) and the methods you use (Set/GetAsync) are used to read from or write to that big table.

An article you may be interested in: attribute-value pair. This describes the concept behind key-value pairs we see for tables.