RBXSerialize : A All-In-One Roblox instance and datatype serializer

Omg
I was hoping you made this
ty

If you expect users to… use the module, you may be able to get away with calling BuildAPI at module load time. Calling RBXSerialize.BuildAPI before the final return RBXSerialize should do the trick. Additionally, you could consider renaming the RBXSerialize module to MainModule so users can always reference the latest version with require(11476525100).

You could avoid these limitations by encoding sizes using a variable-length code such as LEB128 if you prefer size, or by using plain 32-bit integers and string.pack/string.unpack if performance matters.


8/10. This is definitely an option to consider for instance serialization. The base92 representation in particular avoids the horrors of non-UTF-8 values stored in DataStores. One of my earlier serialization attempts (for Lua data types in general) works around this encoding limitation by converting raw bytes to valid UTF-8 characters, at the cost of doubling the output size.

--MIT license ^^ [///removed!///]

It looks like you may have missed a few tiny details.

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

I am not a lawyer, but there’s no way that outright removing the copyright notice could be justified when the entire code is copied verbatim. Then again, no one really cares about copyright (specifically regarding source code) on this platform. I’d recommend leaving copyright notices untouched, just to be on the safe side of legalese.

1 Like

Oops,

I will include the original copyright notices from the libraries I used. Not quite sure when or why i removed it.

Also to keep things simple i read each byte individually, typically instance data will never exceed 255bytes unless it’s like a text label filled with garbage text. But this is better solution that i will consider.

In my previous versions of my module the .BuildApi() was automatically called when you first attempted to encode something. The reason why i did not when the module was seated is due to the high amount of iterations that could sometimes cause my computer to freeze. Doesn’t seem like a big issue with the dump im using currently, just thought i’d make it a separate method so you could put it onto it’s own thread.

hasn’t this already been made many times in the past? I remember seeing a recourse a few months ago about this.

If your talking about instance serilization than yes~! This however is a module that is meant to perserve as much memory as possible which other instance serilization modules dont do, along with the ability to store reference properties and attribute values.

It’s really depends on your use-case on what you’d use, this module however is a rewrite of another serilization module that removes some of it’s limitations. Also ease is another factor on why i think it’s important to have a serializer with two simple methods. The majority of ROBLOX Scripters wont even be able to figure out how to use something like RBXDOM. (That is importing it from GitHub LOL).

Let me know if you have any feedback on what this is missing as I’d like to make this serializer a go-to option.

2 Likes

On the topic of your computer crashes, most likely because of how big those json files are. What would be much faster is initializing the table in pure code. I made a cool module which you could use for generating the code: VTC - Turn anything into code!.

Now we just need a module that replaces Player:SaveInstance() and Player:LoadInstance() and then we can get the old games to work again.

Never heard of this i think i’m too new :sweat_smile:

They simply save an instance storing it with the player’s UserID.

Additionally, it gave each player a limit, which can be found using Instance.DataCost.

Hello! This looks great! Could this be used to DataStore a table of Instances?
I’m making an inventory system and need a way to DataStore a table of all the items in the player’s inventory.
The only issue is that I use folders and instances to store the inventory data, and as you probably know, you can’t DataStore a table of Instances. But if I encoded the table, would I be able to DataStore the encoded table?

Thanks!

Would this serialization module work for strings? Tested it! It does work with strings! The really annoying thing is if it isn’t a Superclass it warns so I had to remove the function and replaced the line itself with continue so it skips through the loop.

Great resource overall!

1 Like

Didnt see this.

Your module does the same thing as mine, looks like you’ve just generated a Lua table from the same dump. Also, this was no-longer an issue something i just did not include before release.

Cool module, but this wont help anything.

So grateful that you made this serialize module !!
but I met a problem when I tried to serialize a “material”, here is my code:

local SerializeModule = require(game.ReplicatedStorage.modules.common.SerializeModule)

print(SerializeModule.Encode(Enum.Material.Plastic)) 

and the error:

 ReplicatedStorage.modules.common.SerializeModule.Conversion:70: invalid argument #3 to 'pack' (unsigned overflow)

is there anything I did wrong?

My module isn’t quite a serializer. It generates lua tables (like the one you saw in the dump) and I thought since you were decoding a json string that it might be faster if you initialized your dump with a lua table.

Ill take a look at this, looks like there was an encoding error.

1 Like

It would be nice if this was a MainModule so it automatically updated.

is not possible on client side due http_service on get api is not allowed but you can use require(Id_module_library) instead

This doesn’t work on the client, but it works on the server, but I don’t think I’d be using this on the client.

This resource came in clutch as I am going to need to save players towers for a Tower Defense game I am working on.

Please keep updating this since it can become a potential resource!

Sorry to bother you again, but I’ve encountered a severe problem while using RBXSerialize. I encoded some materials 10 days ago and tried to encode the same materials today, but the results were different, and now I cannot decode it anymore. Is it possible for this to happen? I am currently trying to save my datastore.