[Outdated] Instance Serializer Plugin - Serialize Instances to be remade with a script later

Changelog is at the bottom
I (re)made a plugin to serialize Instances so that they can be remade by another script. A previous version of this plugin saved me quite a bit of effort, so I thought I would post the new and improved version here for public use. So:

What is it?

This plugin takes the selected Instance(s) and serializes them down to a form that can be ran to recreate them. That is, it serializes them into the general form

local ObjectName = Instance.new("ClassName")
ObjectName.Property1 = Value1
ObjectName.Propert2 = Value2
...
ObjectName.Parent = ParentObject

There is also an option to serialize properties that would normally be restricted for scripts. The plugin also creates two PluginActions that serialize with and without that option respectively (both named a variation of Serialize).

If there are 150 or more descendants to the object being serialized, it is serialized in a separate format that while being messier to look at scales much better. This has minimal impact on the end result, but it’s something to be aware of. An example of this is below.

Descendants are serialized according to their hierarchy, which would normally leave references orphaned. However, this is accounted for, and any references that would normally be orphaned are localized to the top of the output script.

This plugin makes use of the HttpService to get the most up to date Roblox API dump for a table of properties. It also stores a fallback API dump that will be updated every week as long as I remember in case you’re offline or otherwise don’t want to send the request.

The API dump URL used by this plugin is hosted on Roblox.

How to use

  1. Download and install the plugin
  2. Open a place
  3. Select what you want to serialize
  4. Click the button the plugin makes to open the GUI
  5. Click ‘Serialize’ on the GUI
  6. Your selection will change to a script that contains the outputted serialization as its source

Why?

When you need to copy and paste properties into scripts, it can get tedious. This is especially an issue with GUIs which are frequently generated by scripts, but it can happen with any Instance. This plugin eliminates that issue by serializing these objects with a push of a button and a single copy and paste. It’s a utility that I use a lot and get a lot of use out of.

How does it perform?

In my tests, which included a 330 Instance Pine Tree and various parts of Crossroads, all Instances were being serialized in less than a 0.1 seconds. This is very fast. Substantial effort was put in along the way to ensure that this ran as fast as possible as nobody wants Studio to lock up for 10 seconds whenever you activate a plugin.

UPDATE: I have changed the plugin so that the only limitation is on Roblox’s side. Lua’s issue is now a non-entity. I serialized Blackrock (from Crossroads) in about 0.05 seconds with this method, so the performance hit is a non-entity.

Features

I touched upon them above, but I’ll throw this here for a comprehensive list.

  • Serializes Instances (I’ve already explained this).
  • Option to toggle between serializing restricted properties or not.
  • Adds two PluginActions to serialize Instances quickly, one for each state of the above setting.
  • GUI synced with studio themes – No blindness will occur when using this plugin!
  • No orphaned references – Descendants are serialized in order, but any that are referenced by non-parent properties are prepended to the top of the output.
  • This isn’t necessarily a feature but I made the choice to not use PluginGuis for this because of how small the GUI element is.
  • This thing runs fast. So fast it lists how fast it goes in the output after every serialization.
  • No errors: throws a warning into the output of Studio when something goes wrong, but it doesn’t break

Limitations

Roblox restricts the length of string properties – such as script.Source or StringValue.Value – to 199,999 characters in length when set by a script. This means that I naturally have to limit the strings created by the serializer to this length. This may result in your object not being able to serialize properly.

This plugin sacrifices minor efficiencies in the name of readability. I could almost certainly get more bang for my buck with the character count so to speak, but to keep the output as readable as possible, no shortcuts are used. If there is sufficient demand for a maximum efficiency version, I can create one easily, I just didn’t see the point since this is not meant to serialize entire places or gigantic models.

In conclusion

Example outputs: Pine Tree (updated), HillBricks from Crossroads,

You can get the plugin here:
https://www.roblox.com/library/1614059092/Instance-Serializer
The source is available here:
https://github.com/dekkonot/instance-serializer
If you have any issues or questions, please respond or leave an issue on the GitHub repo.

Changelog

- 2/7/2019

  • Adjusted the naming scheme for serialized Instances so they’re less prone to glitches
  • Changed the way large Instances serialize to make it scale better (cc @TheQwertiest)
  • Blacklisted several properties such as FontSize and GuiObject.Transparency
18 Likes

I’d just like to thank you for your work, especially considering I pondered fer a few weeks on how to do this

Thought this would help but i keep getting the same problem. Tried to make my own concat source…next liens and i was getting text to long. And now that i’ve set up my plugin to export the files i want serialized in the way i want i still get same issue. Guess theres no way to get around this…

Closed at request of OP; newer version available.