Furniture backup system creation

It would ultimately save on space for sure, but it depends on if that’s worth it to you. The amount of optimization I’m referring to is really only needed for large scale data saving, such as saving entire sets of chunks (like block data in Minecraft). But arrays still add additional things like brackets and commas that aren’t entirely needed data wise, if you really need to be that efficient on space.

1 Like

But, as I said, you don’t have to use JSON. JSONEncode would encode it to JSON, yes, that’s pretty obvious.

What I mean is save it on the DataStore via :SetAsync passing the value as a table instead of serialized JSON.

By this, I’m assuming you mean JSON objects, not Lua(u) tables.

You can only save a string. We use JSONEncode to convert arrays/tables to a string format.

Technically yes, but ultimately everything outside of objects are strings, or can at least be saved as such (with JSONEncode or perhaps some other method).

You don’t have to use JSONEncode by any means, but you’ll have to write your own method to store datatypes that aren’t standard datatypes like numbers or strings are. But now I’m over-complicating things, so don’t worry about that part.

Excuse me if I’ve misunderstood the documentation, but as far as I know, you can save numbers, strings, arrays, and even dictionaries just fine.

Take this example from another thread:

I cannot speak for how Roblox saves its tables internally, as I have never worked there. However, I would have to assume they are serialized similar to how they are saved into bytecode in plain Lua 5.1, which, by the way, isn’t JSON.

I don’t believe this would work as data is saved exclusively as a string as far as I’m aware. But the documentation does show that the saved value is a Variant (Tuple):


Source

Perhaps an array is automatically converted to a Tuple, but I believe that everything is saved as a string at the end of the day. It also says that you can see the data size by using JSONEncode:


Source

1 Like

Oh, I see. I had no idea. That’s useful to know.

Thanks for correcting me.

1 Like

Yo stop replying to me please yo

After they place the furniture, you can serialize a limited amount of data, or more specifically the minimum needed to recreate the item.

I would suggest lowering the quality of certain aspects, such as rounding the position and orientation of the furniture after placed. You should also implement a limit to how much furniture you should save.

Data stores are limited to 4 megabytes, which is not very much if you serialize every instance.

Thanks for replying me.
Do you know a tutorial to setup it?

No, and I don’t believe there is any suitable tutorial, since this is a very specific topic. Whatever works for you will be the solution.

I’m not, it’s the forum that’s having notification issues.

2 Likes

I’m not sure if this video will help, it’s just the first I found and I briefly skipped through it, but perhaps it will give you a foundation to work with:

Here’s another that seems a bit better and has a playlist:

But please don’t just copy code, it’s better to learn how it works so you can create your own systems without help in the future. Plus the ones above seem to still be a bit over-complicated over-engineered, but it should at least be easier to follow a video than a written guide, depending on your skill level (plus the videos at least seem to cover everything from start to finish).