Turn objects into strings! - SerialBit


SerialBit was made with speed and efficiently in mind. It’s made to store objects. For example, lets say a player made a cool build. How would you save it? You can’t store Instances. But, you can store strings. Serialization is the process the process of converting the state of an object into a form that can be persisted or transported. So, in order to save a build, you could use SerialBit, and then happily store your player builds in a datastore, using a compressed string.

See these totally not free model generic huts here?

Well, the hut on the far left is the original.
The middle, is a model completely rebuilt using SerialBit.
The right, is rebuilt by another serialization module, RbxSerialize

SerialBit was quite accurate, don’t you think?

SerialBit took 0.123 seconds to encode, compress, decode, decompress and then load this model! Without yielding, this would be faster (but you don’t want to crash the server with large models, do you? :wink: )

Infact, heres the string that SerialBit used to create this model.

Serialized string

What kind of cryptic language is this?!?!?! Witchcraft I say!
This string stores all the properties and descendants of the object.


It also saves a lot of space. RbxSerialize produced a string of 5k characters, while SerialBit produced a string of 3.6k. (That’s quite the difference)

Currently, it’s there’s just two functions. But, I can always add more! What do you think?

SerialBit.serial(Object: Instance): string

Serializes the instance and it’s descendants into a string. This can be loaded into an exact copy with SerialBit.struct

SerialBit.struct(Serial: string): Instance

Instances the model from the serial string. Returns a Model.

SerialBit.reference(Object : Instance) : void

The object passed must have an attribute called “REF_ID”. The descendants of this object must also have an attribute called “REF_CHILD_ID”. When serializing a model with a reference, they must have the exact same attributes, but can have different properties.

Selected the desired object(s) and then run this code in the command bar
local Selection = game:GetService("Selection") local Selected = Selection:Get() for i, v in Selected do local AllObjects = v:GetDescendants() v:SetAttribute("REF_ID", game:GetService("HttpService"):GenerateGUID(0):split("-")[1]) for i = 1, #AllObjects do local Object = AllObjects[i] Object:SetAttribute("REF_CHILD_ID", game:GetService("HttpService"):GenerateGUID(0):split("-")[1]) end end

This is our reference object.

In our script, we’d add this using SerialBit.reference

We would then serialize like normal.
We can also change the properties of the reference object:
(hes now tall!)

And when loading the object into the game, it will clone the original reference object, and then apply all of the properties.
You can also use models and basically anything else as references, as long as they have the special attributes.
(It worked! But… everything was unanchored :sweat_smile:)


If you have any issues, suggestion, or nit-picks, please, leave a post! I’d like to hear from you all. Also, this is one of my first posts! :slight_smile:

Doesn’t support MeshParts or Unions. Unfortunately, MeshParts are impossible to implement without using SpecialMeshes, which, in my opinion, is cheating! Union support may be something in the future :eyes:


That’s interesting! I can’t get my hands on it right now, but it could be useful for things such as exporting data from live games into Studio, or creating dynamic place update systems if this serialization really works.

1 Like

you could check for already existing assets saved in the game and clone them for mesh parts and unions or have a folder for it to check for resources

1 Like

That’s something I could totally implement!

[EDIT: Working on it now.]

Update v1.1.0

Added boolean SerialBit.DebugPrints

Added SerialBit.reference

Instructions on how to use it have been added to the post.

This looks amazing! I’ll definitely check it out.

Why is it that

1 Like

Well, you cant set the MeshId of a MeshPart in scripts. But, you can use SerialBit.reference instead, just with a bit more setup. Hope that helped. :slight_smile:

1 Like

Ah, okay. Never knew that you couldn’t set the MeshId of meshparts. Good to know.

1 Like

the package version is offsale

My bad, I just discovered i dont think you can share packages.

why not release it as a model (not a package)

It is released as a model. I released a package along with it, realised it doesn’t work, then removed it.

Nice work, I’ve abandoned by module due to how busy i am nowadays. I use some super old purelua library for compression and don’t necessarily understand it too much. Hence why now my compression is worse. Anyways there are some isseus like the way you store datatypes. However in some cases storing datatypes in pure text will be smaller. And in some cases it will be significantly bigger. Something i’ve wanted to implement is multiple headers for different encoding methods of datatypes and only use the smallest one. Howerver i never got around to it. The point is, offset this model with extreme decimal percision and with a great offset from the world origin and you will use significantly more memory. Consider storing some datatypes in a raw format.

1 Like

This is very cool and useful for safely storing models in your game with out having to worry too much about game theft.

All we need now is a client script serialization which will prevent client code theft and exploiters from viewing the script. All though running said code might be another challenge in it self too.

Keep up the great work!

1 Like

This module wasn’t for securing your game, but rather, for example, storing player builds. Unfortunately, i dont think anything like this is possible.

1 Like

Hello! First of all, I dont understand the compression module I use either :sweat_smile:. Also, wdym “raw format”

The purpose of the module was to condense everything into a string for storage (eg. Datastore). Do you mean storing it raw as in, like inside a table? That I can totally add as an option of storage, too!

Store all numbers in binary. use string.pack() or some sort of binary stream this will decrease your size significantly.


Thanks for the advice, ill have to research this stuff when I get home

did you implement that for the current update?

I really appreciate the idea!

I already implemented it! It was part of version 1.1.0. If you have any other ideas, tell me!