Once upon a time, I made a plugin to convert things into scripts so that I didn’t have to copy properties over manually. Now 4 years later, I’m on the 3rd rewrite, and posting it here.
This plugin, like the title says, converts an instance and its descendants into scripts so that they can be created by a normal script or plugin later down the line. So, for example, if you had a granite cube that was 5x5x5 and was bright red:
Then with the default options it would get converted to this code:
local Part = Instance.new("Part")
Part.BottomSurface = Enum.SurfaceType.Smooth
Part.TopSurface = Enum.SurfaceType.Smooth
Part.Color = Color3.fromRGB(255, 0, 0)
Part.Material = Enum.Material.Granite
Part.Size = Vector3.new(5, 5, 5)
Part.Parent = workspace
Options
There are some options to modify what the output looks like or what gets serialized or not. They’re adjusted by the GUI interface, which looks like this:
While the text next to them is at least somewhat informative, a more detailed explanation for each of them can be provided:
Minify output
When this option is selected, the output is minified. This means that as little space as possible is occupied by the output while still keeping it workable and at least somewhat readable. If the serializer was ran with this option, the example code snippet would become:
local a=Instance.new"Part"
a.BottomSurface=0
a.TopSurface=0
a.Color=Color3.fromRGB(255,0,0)
a.Material=832
a.Size=Vector3.new(5,5,5)
a.Parent=workspace
Output modules
By default, the plugin puts the outputted code into a normal Script
. With this option turned on though, it’s instead placed in a ModuleScript
and returned. There’s no substantial modifications to the code snippet with this option turned on, but for the sake of completion the example would become:
local Part = Instance.new("Part")
Part.BottomSurface = Enum.SurfaceType.Smooth
Part.TopSurface = Enum.SurfaceType.Smooth
Part.Color = Color3.fromRGB(255, 0, 0)
Part.Material = Enum.Material.Granite
Part.Size = Vector3.new(5, 5, 5)
Part.Parent = workspace
return Part
Parent main model
This option defaults to true, and toggles whether the topmost selected Instance is parented or not. If the option were turned off, the example snippet would become:
local Part = Instance.new("Part")
Part.BottomSurface = Enum.SurfaceType.Smooth
Part.TopSurface = Enum.SurfaceType.Smooth
Part.Color = Color3.fromRGB(255, 0, 0)
Part.Material = Enum.Material.Granite
Part.Size = Vector3.new(5, 5, 5)
Serialize restricted properties.
Simply put, this option toggles whether properties that are locked to normal scripts but accessible to plugins and the command bar are serialized. The most obvious use for this is Script.Source
, but there are a bunch of locked properties that this option enables the serialization of. If you need to use this option, you’ll know why.
Caveats
This plugin requires very brief HTTP access so that it can load the most recent API dump. Without it, this plugin won’t function. The API dump is loaded from CloneTrooper1019’s client tracker.
Additionally, at the moment script sources have a hard limit of 199,999 characters when set by another script. As a result, sufficiently large models will instead be split into multiple modules and loaded from there.
Extra stuff
This plugin’s source is available here:
If you have any questions or problems, either open an issue there or reply here and I’ll get back to you as soon as possible!