RBLXSerialize - a easy to use and really cool all-in-one Roblox Serializer

It works more on the datatype then the property name,

But i beileve TextureIDs are a Content DataType and should already be saved.

MeshIDs cannot be modified, if there are any issues while decoding it should show up in
your console. Which is a reminder that I should be filtering out any non-scriptable properties.

I’ve been thinking about adding some type of non-scriptable cache to the module, but i dont know if it would be worth it.

Heres from the documentation

The MeshId is the content ID of the mesh that is to be displayed on the MeshPart .
Note that this property currently cannot be changed by scripts as the collision model of the mesh cannot be recomputed during runtime. Developers should not rely on this behavior as it may change in the future. Those looking for a custom mesh object that can be updated during runtime should use SpecialMesh .
MeshPart.MeshID.

So i should be using SpecialMesh, huh i didnt know. But does the module even support that?

Another Question that I should ask… How do i find out the name of the datastore… or to be more precise, How can i encode a model from 1 place then decode in another? I dont know what the module names the datastore the serialized model is in or if the module can recognize models that arent defined in the script (To decode the model) but are stored in the datastore as something.

The string is storable in datastores, so as long as you can access it, you can decode it…

How you manage all of the players parts is up to you, however i think the best way probably is with a folder . Decode when they join, encode when they leave.

waat? So this 1 string can actually let you have access to an entire model (If it exist in the datastore)?! damn, thats like having a security code to get something important.

You still havent answered my question of if the module supports specialMeshes

If it doesnt, then its a good idea to add in support. Unlike MeshParts, SpecialMeshes do not calculate the collision bounds of the Mesh but instead use the collision bounds of the basepart (“No precise collision, Just a square-ish type of collision”). Because of that, scripts can actually modify the “MeshID” of the SpecialMesh instance. Infact, its the sole reason why the MeshPart’s MeshID property cannot be modified… because of the fact it needed to recalculate the collision of the mesh and that roblox does not have a system/engine to recalculate collisionBounds in real-time.

I beileve SpecialMeshes do work. Again as long as the properties are scriptable it most likely can be serialized. Only really one way to know, and thats to try and see. I havent tested every instance myself, as the serializer only caches information and references it really doesn’t know what its storing.

A rule of finding out if properties are supported is, as long as the property datatype matches the supported datatypes aswell as being scriptable. ​

Also, I probably wont add any specialized support that makes me do anything else.

Instance support is almost 100% dependent on my API Dump which working on to update.

Unlike most of the available instance serializes, the data is stored in raw data instead of a serialized table. But its essentially the same thing as storing a json string.

Tried this using SpecialMeshes and turns out im kinda right… you do need parts with special meshes for it to work.

This is perfect for a project I’m working on! Thanks!

Just two questions: I’m working on a package manager (spm: Studio Package Manager) and I’ve been working to find a way to serialize Instances in plugin:Set/GetSetting-compatible format. Just a few questions:

  1. Is this able to serialize LuaSourceContainer.Source?
  2. Can I use this with plugin settings APIs even though you mostly mention DataStore serialization as a use?

I’ve seen a n issue /w attaschments and certain instance references not working properly i’ll put an update soon.

For LuaSourceContainer.Source It can be easily added, i’ll add a setting .AttemptToSaveSource which will only work for plugins of course.

I would assume not as i beileve it is just a normal lua table?

For encoding and decoding strings, use the code example below.
I didn’t see any see an example listed for strings so I quickly threw this together for people wanting to. If there is an example already listed for strings then I just need to get my eyes tested lol.

But anyways, this is an example for decoding and encoding strings. (Helpful for hiding token and auth codes for Trello in a module so if someone saveinstances your game they can’t see the token or auth strings without knowing how to decode it.)

Script:

local RBLXSerialize = require(script.Parent.RBLXSerialize) 

local BinaryString = RBLXSerialize.Encode("test string",true)
local StringDecoded = RBLXSerialize.Decode(BinaryString,true)

print("Encoded output: "..BinaryString)
print("Decoded output: "..StringDecoded)

Output:
1

bro they can just copy the encoded token and decode it

Not if you encode the results a few times and make a script to decode it the same amount of times, also they’d have to know to look here to find out.

Anywho, I’m pretty sure you can change the values that it encodes it in to make your own custom encode/decode language seems as this is open source.

So is it actually possible to serialize/deserialize scripts? I mean considering what you just said, i guess thats true? Would be a heckton useful for stuff that needs to be eventually be imported to save system resources. Or even better, store stuff that a player has customized.

Why would you be serializing meshes, vehicles, welds, scripts, etc?

Sensitive data or data that can be generated from less information should never be stored. You can always clone a base model and modify it to your liking from saved data. Items such as Welds should not be saved as they can be destroyed in the construction process. Just re-weld the model/object afterwards.

Forgot to add that this is an amazing resource. Big thanks, will be using this in the future. @AwesomeXForLife

Why would you be allowing an exploiter to view private keys? FYI for anyone reading, exploiters cannot read the following :
ServerStorage
ServerScriptService
Server-generated/controlled instances (Scripts, not to be confused with localscripts or modulescripts)
Offsite stored keys (assuming the webserver is not publicly shown)

Your keys should never be stored in a place where an exploiter can read them. Client’s only have so much power.

That is SO NOT the case, the RBLXSerialize module actually works well with meshes and welds.

I mean why not? why not serialize all the stuff?

There are several reasons to that question. But i dont see those stuff as sensitive data at all.

???

Why not serialize all the stuff you ask, the answer is right below.

Serialization is the act of giving an object an identifier. Most data types on Roblox such as CFrames, Positions, Instances, and so on cannot be serialized. The way around this is modules like these.

The reason however why you would never want to serialize everything is because of performance issues, especially when saving and loading said serialized data.

When you are loading a Model with 100 parts, and each part is being created and loaded from saved data, you are using up memory because instead of Cloning a base model and changing properties from there, you are generating a new model from scratch. (Much better to use SetPrimaryPartCFrame instead of 100 positions being changed). That in itself is not so bad, a few KB of memory, whatever. The issue is that when you are using more data types (Welds, Meshes, Models, Parts, Unions) and so on, you are serializing more and more data. Roblox does have a data limit (if I’m not wrong it’s 260K characters after JSON encoding). Once you reach that data limit, issues will occur (not to mention that memory will start to crash servers).

tl;dr : don’t serialize and save everything because Roblox has a data limit and it uses up massive amounts of memory based on the amount of instances you are serializing (leads to server crashes)

It’s actually 4MB for a while now.

Please consider using new Pivot API instead of superseded SetPrimaryPartCFrame

1 Like

I don’t allow people to view that.

However, people that have synapse can use a saveinstance script and saves the code for all LocalScripts and Modules. My point is if you encode a string that is valuable, e.g. a token/auth code for trello accounts, the hacker won’t be able to get to it unless they know how to decode it using the RBLXSerialize module.

So when I showed the example of encoding/decoding strings was so that people can add an extra level of security for attempting to hide data in modules so that you can easily update it for all scripts without having to change the token in each and every individual script.