Instance to ModuleScript Converter | Convert any instance into an array of data!

Overview

Instance to ModuleScript Converter is a plugin tool designed to convert any instance into a digestible module that can be used for game creation, DataStores, table management, and more! This tool can also be used to create a visual reference of your ModuleScripts/tables for easier navigation.

Creator Marketplace Link

Roblox Creator Marketplace

Instance to ModuleScript Converter
https://www.roblox.com/library/9067285513/Instance-to-ModuleScript-Converter

Features

Five versatile Output Methods:

  • ModuleScript
  • Normal Script
  • JSON Script
  • Output
  • Pastebin [Requires Online Mode and a Pastebin Dev API Key]

Automatically converts all ValueBase Instances*.

  • BoolValue
  • IntValue
  • ObjectValue
  • CFrameValue
  • etc.

*ValueBases parented under other ValueBases will not be converted into separate subtables and will rather be included as multiple table parameters.

Click to view example

Many different conversion options.

  • Properties
  • Attributes
  • Location Support
  • etc.

Selecting a ModuleScript brings up an option to convert it (if its properly formatted) into a Visual Directory via Folders/Configurations for better navigation/viewing.
Extremely useful feature for those that aren’t well versed with Roblox Lua or tend to make formatting mistakes while editing/navigating tables.

Supports most value types.
(See Limitations for unsupported types.)

Screenshots

Screenshot_3576

Use Case Examples

Inventory Systems

InventoryExample

Player Data

PlayerDataExample

Store Any Instance/Directory as a ModuleScript/Lua File

InstanceDataExample

Limitations

  • Attempting to convert massive directories (1,000+ Instances with multiple conversion options enabled) may temporarily freeze Roblox Studio while processing. (The amount of time frozen relies entirely on your processing power, system memory, how big of a directory you have selected, and Studio itself.)

  • The more nested item locations a directory has, the longer it will take during the “Locating Strings” step during conversion.
    For example: [Selected].Model.Model.Model.Model.Model.Model.Model.Part will take much longer during the “Locating Strings” step than a directory where the deepest instance is closer like [Selected].Model.Part

  • If any location type property is nil (CustomPhysicalProperties, Constraints, PrimaryParts, etc.) the converted module will NOT include a variable for that value. I can’t think of a reason of why you would need nil values in a table but if do, you will have to define/write them yourself.

  • This converter does NOT support converting a module back into its instance form! If you know what you’re doing, it should be fairly simple to create a script that can convert the modules back into instances on your own.

  • This converter does NOT support deprecated, hidden, non-replicated properties or the following Instances:

      Terrain, BinaryStringValues, RayValues
  • This converter does NOT support the following values/types:
      Ray, Axes, Faces
  • At time of writing, this converter supports most types but it will not natively support new types that become added with future Roblox Studio changes.

    • If you get this error in your output
      Found new value type. Item Name: _ | Value Name: _ | Type: _ | Value: _
      and it isn’t listed as an unsupported type above, please comment it below so I can update the plugin to support it!
  • I’m not going to say you can’t do it because the functionality is there, but this converter is not intended to convert back and forth between ModuleScripts and its Visual Directory. The Visual Directory feature is meant only to visualize a ModuleScript. A Visual Directory should not be converted back into a ModuleScript (especially if you use different settings than when initially converted) and a Visual Directory should not be used as a source of Data unless you know what you are doing. If you do convert back and forth, you may end up with disorganized, incompatible, or inconvertible module data.

Pastebin

In order to upload to Pastebin, the plugin must be set to Online Mode and the Output Mode set to “Pastebin”.

  • You are required to use your own Pastebin Dev API Key to upload to Pastebin which can be found here under the “Your Unique Developer API Key” section.

  • Modules uploaded to Pastebin are temporarily converted to PHP with the plugin, which may result in a 200% or greater increase in module size depending on how many spaces and lines are in the converted module. This conversion process is necessary to send the module info to Pastebin since their API utilizes PHP instead of JSON/raw text.

  • Pastebin has an upload limit of 500 KB for all non-pro users before formatting and 1 MB for all users with PHP formatting.

  • Pastebin has a posting limit of 20 posts per 24 hours and 10 total active unlisted pastes at a time for all non-pro users. You can find more information here.

  • Uploaded modules and their respective links are set to expire 1 hour after conversion and successful upload.

  • Modules uploaded to Pastebin are UNLISTED and can be accessed by bots parsing the website by brute-forcing URLs. Even though I’m not sure what someone would even want to do with a random lua module, if privacy is extremely important regarding your module, select a different Output Method (ModuleScript, Output, etc.).

    • The reason new pastes are unlisted instead of private is due to Pastebin requiring 3 different parameters (Dev Key, Username, and Password) when making private posts via the API and I felt like that info was both way too much to input and completely unnecessary for a plugin like this.

NOTE: I was initially going to use paste.ee because it allows unlimited posts and a larger file size limit but ended up running into issues authenticating my Dev Key with both the legacy API and the current paste.ee API, so Pastebin will have to do for now unless someone can provide a dependable third-party open source without limits that has a PHP/JSON API that Roblox can make Post requests to.

Permissions

Script Injection

This permission is required for “ModuleScript”, “Normal Script”, and “JSON Script” Output Methods. This is necessary to create a script object in your game’s experience.

HTTP Requests

While Mode is set to “Online”:

  • https://setup.rbxcdn.com/<CurrentStudioVersion>-API-Dump.json

The domain path will change according to your current studio version but will always be apart of this same master domain: https://setup.rbxcdn.com/

HTTP Posts

While Mode is set to “Online” AND Output Method is set to “Pastebin”:

  • https://pastebin.com/api/api_post.php

Roblox Changes That Can Make This Plugin Better

Below are a list of requests I have for Roblox that can help improve functionality and performance of this plugin, in case any Roblox Staff happens to see this post:

  1. Increase Roblox ProtectedString limit.

Currently, plugins can only create Scripts and ModuleScripts up to a maximum of 195 Kilobytes due to the ProtectedString limit (writing only).

  1. Create a function that can be accessed by plugins to AutoSave Roblox Studio.

This would be very beneficial to end users that use high performance plugins like this one that can cause hangups during large conversions. It would be a great way to get game experiences backed up in case Studio crashes or freezes longer than expected.
For example: game:AutoSave()

  1. Create a function for all instance class items that returns a table of string containing all properties of an instance.

For example: Part:GetProperties()

Disclaimers

  • This plugin isn’t perfect, may not work as intended, and may not be applicable to all use-cases.
  • This plugin should not be relied upon for full fledged game projects, this is meant to be used as a quick and easy-to-use tool rather than a dedicated game design tool. This plugin may prove helpful for some use cases (even for some game projects) but you should have an understanding of how to manage modules on your own rather than completely rely on this tool.
  • Conversion errors may occur but I have attempted to provide understandable output errors for as many situations that I could think of.
  • This plugin may also completely freeze/crash studio during a large conversion so make sure your experience is saved locally or to Roblox before attempting to make any conversion!
Click to view changelog

Changelog History

March 11th, 2022 | v1.0.0
  • Proof of concept
  • Basic functionality with no customization
  • Extremely long processing times (about half an hour or more for directories larger than 10,000 Instances).
March 26th, 2022 | v2.0.0
  • Complete UI Overhaul, Studio theme compatibility, and reformatted into a draggable widget instead of the outdated CoreGUI style.
  • Added a progress bar for large operations.
  • Added many warnings and errors for different scenarios.
  • Added configurable Output Methods and Settings.
  • Added Pastebin as an Output Method.
  • Added a conversion stop button.
  • Conversions now run asynchronous. Greatly reducing conversion time by up to 80% but with a drawback of large conversions freezing Studio.
  • Plugin now uses its own copy instead of modifying the original source instance.
  • You can now select any properly formatted ModuleScript to be converted into a Visual Directory. (Attempting to convert a ModuleScript that has an infinite yield variable will freeze the plugin!)
March 27th, 2022 | v2.0.1
  • Removed Animinus API dump and made all property fetching completely offline.
  • Updated the Offline API to be the latest copy of the Official Roblox API instead of a copy of Anaminus’ API. I will continue to manually update the Offline API with the latest Official API every now and again as more classes and properties get added/removed from Roblox or until Roblox provides a proper :GetProperties() function.
  • API Version: version-151007c9ec894725
March 28th, 2022 | v2.0.2
  • Added an Enum conversion option to allow Enums to be formatted in string instead of Enum. (This will allow slightly smaller file size due to less characters when set to “String”.)
  • Intended DevForum Launch & Public Release Date but the plugin thumbnail was rejected/is not processing?? Launch date pushed back until the thumbnail passes manual approval.
March 31st, 2022 | v2.0.3
  • Fixed an issue for all instances not having “Parent” listed as a property in the API digest function.
  • More than 72 hours later and still not approved. Got to love needing manual approval for a single thumbnail. Phenomenal. What are deadlines, amirite???
April 1st, 2022 | v2.0.3
  • I’m tired of waiting. After such a long delay, I’ve decided that I will just initiate the DevForum Launch & Public Release today instead of waiting for something that may never happen. I guess it will just have to launch without a thumbnail for the time being…
April 1st, 2022 | v2.0.3
  • Thumbnail finally went through!
April 2nd, 2022 | v2.0.4
  • Disabled the functionality to convert ValueBase directories since it resulted in improperly formatted modules. (It can still convert ValueBases, just not from directly selecting a ValueBase as the directory.)
  • Changed formatting of the converted module to include “local” before defining the table/array.
  • Updated the Online Mode to fetch from the Official Roblox API source. All property fetches while the mode is set to “Online” will now be up to date! Special thanks to Anaminus for providing the alternate rbxcdn domain.
April 4th, 2022 | v2.0.5
  • Increased button contrast for better viewability.
  • Renamed a conversion option from “Support Location Types” to “Include Object Variables”
April 14th, 2022 | v2.0.6
  • Added a “JSON Script” Output Method. All supported types are automatically formatted for JSON compatibility. Converted variables that are math.huge or infinite will be represented by “inf” since JSON does not support infinite numbers/iterators.
  • Added a “Color Scale” conversion option. Formatted as follows: 1 = Color3.new, 255 = Color3.fromRGB
May 14th, 2022 | v2.0.7
  • Fixed an issue where if the plugin was closed using the x button instead of the toolbar button, the plugin would re-open during every Studio session. The plugin now properly retains it’s persistence across sessions. Using the close button or the toolbar button will change whether or not the plugin will be displayed during your following sessions.
20 Likes

I was gonna make something like this but nic.

You can use Roblox’s API dump directly:

  1. Fetch the current version hash of Roblox Studio from the following URL:
    https://setup.rbxcdn.com/versionQTStudio
  2. Fetch the latest API dump by replacing <HASH> in the following URL with the retrieved version hash:
    https://setup.rbxcdn.com/<HASH>-API-Dump.json

rbxcdn.com isn’t filtered by Roblox, so it’s okay to make requests to from Studio.

7 Likes

Awesome, thanks man! I didn’t realize that domain even existed. I thought the only official site was http://setup.roblox.com/versionQTStudio. I thought it was very strange how it wasn’t possible to make HTTP requests to. I guess I should have looked around more. I’ll go ahead and give the plugin an update within the next few days to support the online API now that I can utilize the official source.

BTW, thanks so much for your old scrapes, I based the early versions of this around it as a placeholder API to test functionality and performance. It was a great help because it was the only API source I could find that seemed very dependable!

Does this save scripts? If so your a life saver.

This is pretty neat along with all the options to chose from. I Believe something like this already exist made by Sleitnick but without the extra options Object-to-Lua Serializer

Isn’t this just the same as Codify by @cxmeels?


Either way, this definitely has some unique features.

1 Like

it isn’t really.

This overall has more customization than codify. You can’t include attributes in codify like with this plugin.

1 Like

I’m not entirely sure what you mean when you say “save scripts” but it does create a ModuleScript when the Output Setting is set to “ModuleScript”. The ModuleScript will be created under the same parent as your selection.

You can save it locally by right clicking the ModuleScript and then clicking “Save to File” or alternatively if you want to save to the cloud you can click “Save to Roblox”.

To address those other plugins, I should preface this by saying I haven’t tested either of those plugins and that I’m only basing this off of their DevForum posts/glancing at their provided demos:

  • In sleitnick’s Object-to-Lua Serializer from what I could tell, it seems like it’s a proprietary format used only to replicate instances through executing the module function.

    The core functionality is extremely different than Instance to ModuleScript Converter. Instance to ModuleScript Converter does not support replicating instances. It only supports the gathering and formatting of the instance data. (See Limitations for more info.)

    Click to view Object-to-Lua Serializer Demo
  • In qsqrl’s Codify, it seems that the data is formatted to create a list of variables for a normal script format (again for replicating instances), rather than an array of data formatted for a ModuleScript.
    Click to view Codify Demo

The core intended functionality of the Instance to ModuleScript Converter is to convert all of the instance data into a module format that can be digested by other scripts. Whether that be replicating instances, making inventory systems, creating player data, making player stats, etc. What you do with the module data is up to your creativity and your use-case but you still have to make scripts on your own to digest the modules. This plugin simply converts instances into a ModuleScript format, converts modules into visual folder directories, and nothing more.

This plugin should be extremely useful for making DataStores or creating data references that may be required by other scripts. For example, if I were to use the regular script formatting from Codify, I would need to copy each of those variables to every single script which would be very tedious and create extreme clutter. Whereas when utilizing modules, I can just reference all of the variables from a single ModuleScript using require().

Personally, I use the plugin to convert folder directories into playerdata modules and inventory modules as it’s much easier to edit attributes on a folder/tool than it is to navigate a massive array with multiple subtables. It’s also much easier to use the integrated value pickers from the Properties window (Colors, NumberSequences, Booleans, etc.) rather than having to type them all out manually.

This plugin also includes quite a bit of customizable settings to include/exclude certain data in the converted module as well as a few formatting settings to make it versatile for multiple use-cases.

not at all! just plop the generated code into a ModuleScript, and return the root instance (which should be sufficient). tabulating those instances could be added if that’s something people want though

however, this plugin does do the whole instance to data structure thing, which is nice for those that like to use ValueBases to store player data (I’m assuming this is what the “DataStore Compatibility” toggle is). it’s not something that will be added to Codify, since that’s not what Codify is for

offline mode is also something I don’t plan to offer. Codify will fetch the API for your currently installed version of Roblox Studio on first use, and will reuse that data. in this sense, Codify can run offline after a first use, but I don’t plan on integrating a full API into Codify for offline use, as the API does change between versions

exporting to pastebin is also a nice touch. that’s been on Codify’s to-do list for a while (export to Github Gist), but not yet implemented


fwiw, Codify supports this too. there’s many formatting options available to match your preferences and coding style

in terms of properties, Codify only exports those that differ from the default settings. this helps reduce the length of the generated code snippets by excluding properties that don’t need to be assigned to, because they already match their default values


attribute support is something I can add to those frameworks that support it, again, if that’s something people would like to see added


based on the screenshots of this plugin, I do have a little feedback for you:

  • increase the contrast between the background and checkboxes/buttons. they’re a very similar shade and when they’re not selected, it’s pretty difficult to distinguish where the clickable area actually is

  • swap out the buttons for “Mode” and “Output method” for actual dropdowns (with an arrow icon to indicate that they’re dropdowns). they currently look like they’re either buttons or text boxes, and as a user, I wouldn’t know what to type into them, so I’d probably leave them at their default settings to avoid messing anything up

  • add hints below each of the configuration options. this explains more to the user about what each option does. a couple of the options (“Support Location Types” and “DataStore Compatibility”) are a little vague, and could do with a concise explanation so that users can easily decide if they want to enable/disable them

2 Likes

Thanks for the UI feedback!

  • I went ahead and darkened the button color to have a higher contrast from the background. (Previously a 2% difference, now 8%.)

  • You can rest assured, the end user can’t mess up any of the conversion settings. The option fields are entirely made up of TextButtons, which change when clicked, requiring no manual input from the end user.

  • The wording with “Support Location Types” is a bit confusing so I have renamed the setting to “Include Object Variables”.

    The “DataStore Compatibility” setting is pretty straight forward. Modules/tables are either DataStore compliant or they aren’t. DataStores only allow string, numbers, and booleans. As the name of the setting implies, when enabled, the converter will translate and reformat any non-compliant type (CFrames, Colors, Objects, Enums, NumberSequnces, etc.) to be compatible with DataStores.

GitHub Gists was very appealing to me as well given how well structured, more flexible, and better accessible it is over Pastebin, though ultimately I decided it was unnecessary for my ModuleScript conversion plugin since it would just add major complications. As far as I can tell from their API Documentation, I believe they only allow HTTP Post requests with attached files, which Studio’s HttpService:PostAsync() function does not support (data is formatted in string).

From my understanding, it would require developing and hosting an API to receive post data from Studio, then it would need to decode that data and convert it into a lua file format, then send another formatted HTTP Post with the attached file. It would also need to include a function in the API to remove Gists after a certain timeframe as to not take up storage space. All that effort just to make a Gist seems like too much for a simple Studio plugin in my own opinion.

I would always recommend HttpService:RequestAsync over Post/GetAsync. RequestAsync includes the ability to specify the HTTP method (e.g. POST, GET, PUT, DELETE, HEAD, and so on…).

in regards to authorising a user to post gists on their behalf, you can use GitHub’s Device Flow authentication, which presents a code to a user that they enter in a web browser, and returns the authentication token back to your app

you don’t need to delete the gist after a specific time period; there’s no storage limits on Gists, and the user can just delete it when they’re done


glad to know you updated the contrast and wording though! :+1:

1 Like

While RequestAsync has more advantages than PostAsync by allowing specific HTTP methods, PostAsync has worked exactly as needed so far since I have only been making post requests. Thanks for the recommendation! I’ll be sure to engage RequestAsync in the future.

The complication I specified with GitHub Gists was the use of files, which neither PostAsync nor RequestAsync support. As far as I could tell by looking through their documentation, in order to post to Gists I would still need to make/host my own API to convert string data into lua files and it would then need to send another post request with the attached converted file to GitHub. This is why I chose Pastebin over Gists as it decodes PHP formatted string natively in their API instead of requiring attached files.

When I noted that the API should remove Gists, it was just a suggestion as to how I would operate it. I just wouldn’t want to take up unnecessary space on their servers. When creating Modules for directories thousands of instances big, the file size can reach upwards of 20+ MBs with multiple conversion options enabled. That could end up taking a lot of server space if many people use it over a long enough period of time.

1 Like

Is there a way to post to github or gisthub instead of pastebin and using JSON instead of php?

This plugin does not support Github Gists, only Pastebin. You can review my reasoning in this reply from earlier in this thread.

Click to view quote.

This plugin has the Pastebin Output Method for convenience. Pastebin is used to host modules temporarily so the user can download/copy/share it. Any modules uploaded to Pastebin automatically expire 1 hour after posting.

For most use cases, I suggest using “ModuleScript” as your primary Output Method when using this plugin since it creates the module directly into Studio. The only drawback to this Output Method is the size limit of your conversion, which all plugins are limited by. (Roblox ProtectedString Write Limit:195 Kilobytes)

If you’re asking about different output formats, all output formats with this plugin are formatted for Roblox ModuleScripts in Lua. When being posted to Pastebin, the Lua data is converted into PHP only so their API can digest it. Once it is successfully posted with their API, it is converted back into its original raw Lua format. The PHP format is only for the API backend. Here is an example of a module uploaded to Pastebin.

If you’re asking if it’s possible to post to Gists on your own outside of this plugin, you would have to curl your own HTTP Request outside of Studio with these parameters/formatting alongside whatever attached files you are trying to upload.

Could you clarify what your use case might be? I might be able to provide a better answer.

I prefer using Github and Gist rather than PasteBin.

I’d use this for keeping a list of Items, Weapons, etc updated automatically in code, so I don’t have to manually do it every time a change is made. I’m using this for DFlag and FFlag feature in my game, currently I use Gist for that but I have to manually edit the file every time there is a change.

Perhaps I could try using PasteBin but can I do the same with it andhow often is the change reflected? Gist updates every 5 minutes

The key here is for me to make changes from any device from anywhere using a browser.

Perhaps this is outside of your plugin’s scope

but how would I read the file from Pastebin, I’m not sure if you covered that in the OP

It appears Pastebin can have pastes read using their Scrape API but only for whitelisted IPs (which I’m pretty sure Roblox’s HTTP Service is not). Also, all conversions uploaded by this plugin expire after 1 hour as to not fill up non-pro users posting limits of 10 total active unlisted pastes.

If I understand correctly, you fetch the Gist data from your game using HTTP requests to GitHub and change variables in your JSON table remotely and what you want is to easily convert instances from Studio into a JSON format instead of having to type out each variable manually every time you add/remove a variable? Unfortunately, as I mentioned in my earlier replies, I don’t believe the plugin can natively upload to GitHub due to Studio’s inability to attach files to HTTP requests.

This converter doesn’t currently have an option for JSON formatted data, only Lua formatted for ModuleScripts. However, I can implement a conversion option that creates a JSON script alongside the ModuleScript but it will have the same limitations as the ModuleScript (195 Kilobytes) which you can then copy and paste to GitHub Gists.

To clarify, even though this proposed option would provide formatting for JSON, the process would not be automatic. You would still need to access Studio and use the converter to make new JSON scripts since this converter is not a passive plugin, it requires user selection and button activation.

Would that plugin option help apply the converter for your use case?

I think my use case is out of your plug-in’s scope. I’ll have to make a solution of my own :smiling_face_with_tear:

Thank you so much for your replies and effort!

I’ll definitely try out your plug-in and provide feedback!

Yes

1 Like

I went ahead and added support for JSON formatted modules.

You should now be able to create a JSON formatted array from any directory/instance you want!

Once converted, just copy and paste the JSON data from the script into Github Gists or your preferred API data host.

Note:

  • Since the output script is formatted in JSON instead of Lua, the Script Analysis window will notify of a bunch of Syntax Errors for every JSON module. I would suggest deleting each JSON module after you have transferred its data, that way the Script Analysis flags/alerts disappear.
  • Needless to say but I’m going to clarify this anyways for anyone that happens to utilize this Output Method: JSON encoded modules cannot be read from or used as game scripts since they aren’t formatted in Lua. Doing so will result in an error.