Rose: A Feature-Complete Roblox Instance Serializer

rose

Rose: A Roblox Instance Serialization Library

Get it on GitHub!

Rose, short for Roblox Serializer (RoSe), is a feature-complete Roblox Instance serializer, written entirely in Luau. It is capable of converting any instantiable Roblox instance into a corresponding Lua table while preserving descendants recursively and storing their properties.

It is designed to be general purpose, small, and fast. Current benchmarks are around 120,000 instances per second for serialization, and 70,000 instances per second for deserialization!

I encourage you to visit the GitHub page. There’s example workflows for converting the resulting Lua table into text representation, which can be particularly useful for Datastores and similar applications.


Usage:

-- To turn an Instance into a table:
local rose_table = rose.serialize(instance)

-- To turn a Rose table back into an Instance:
local result = rose.deserialize(rose_table)

-- Rose does not place the deserialized instance in the workspace.
result.Parent = workspace

Note:
At the moment, Rose comes with support for the most commonly used Instances in the workspace. If you need to serialize an Instance is not supported by the latest dataset, instructions for adding support for it can be found here. It’s relatively simple.


20 Likes

Does this means we can use this to store builds on data stores?

1 Like

so you can’t pass in an array of instances as an argument to the .serialize() function?

1 Like

Yes* using the following workflow:

* The asterisk comes from the many limitations of Datastore, mainly size. Rose tries to make its output as concise as possible, but it is inevitable that you may have some repeating data (like many very similar instances).

Because of the nature of the data, compression is highly effective in reducing data sizes (by something like 70 or 80%). By my current estimates for Rose v1, you could probably store about 80,000 instances per Datastore entry with compression, and 20,0000 without it.

1 Like

Rose automatically serializes an instance with their children, and their children’s children, and so on. All descendants which can be serialized will be serialized. This is why the serialize function takes in only 1 instance as an input.

If you want to serialize multiple different instances for whatever reason, you are correct that Rose does not currently support those, although you could easily call the serialize function per instance. The overhead on this is not very large.

I highly recommend grouping all the instances you’d like to serialize in either a model or folder, and then just serialize that instead.

2 Likes

alright thanks,

also, if i’m planning on saving the player’s position, how would i de-serialize it? i don’t think just setting the parent would solve much… or is rose not meant for that type of stuff

1 Like

If you’re just saving a single value, you can extract the properties of the Vector3 yourself, or use a library like this. Rose is built for serializing instance trees.

1 Like

Thanks for this, this has helped massively with my plugin.

1 Like