Is there a way to datasave tables?

i would love to know if theres a way to datasave a script table?

Use JsonEncode to encode the table as a string!

Yes, you can save any table as long as it doesn’t have mixed keys or any values that aren’t strings, numbers or booleans.

@lrisDev data is JSON encoded when you :SetAsync, no need to do it manually.

sorry :sweat_smile: I don’t know what any of that is, I just started using tables and now I wanted to know how to save them. do you think you could explain what your saying?

-much appreciated

So a mixed key table is a table that has multiple types of keys:


local myTable = {
    [1] = 'number index';
    ['string'] = 'string index';

Those can’t be saved to the datastore.

Tables that contain Vector3’s, CFrames, Color3’s etc can’t be saved to the datastore, you would have to save them as a table and unpack with table.pack and .unpack functions.

The following can be saved to the datastore:

  • booleans (true or false)
  • strings (valid UTF-8 characters)
    Complete Character List for UTF-8
  • tables
  • numbers (1, 2, 3, 4, 0.000000012343238349, 12391203.12309109 etc…)

Basically, if you do type() on the datatype and it returns “number”, “string”, “table” or “boolean”, you’re good to go.

When data is saved, it gets converted to a string and then back into a table when calling GetAsync.

So is there no way to save this:

local module = {
	["Amogus"] = {
		["ItemName"] = "Amogus";
		["KnifeClass"] =, 0, 179);
		["KnifeIcon"] = "rbxassetid://6344756217";

Here’s a couple topics that should help you out!

These show how to save them and load them.

And your data here wouldn’t save because of the Color3 value, so if you took that out it would then.

No, not without modifying it.

['KnifeClass'] = {

Then on load,

local knifeClass = data.KnifeClass

knifeClass =