PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.

Intro to Plugins

Intro to Plugins

10 min

A plugin is a custom add-on to Studio which introduces new features above and beyond normal Studio functionality. You can either install community-made plugins or create your own.

Finding and Managing Plugins

You can find new plugins in the Toolbox by clicking the Marketplace tab and selecting Plugins from the menu.

Once installed, you can manage/update a plugin through the Manage Plugins button in the Plugins tab.

A
Update — Gets the latest version of the plugin.
B
Active — Toggles whether the plugin is active or not.
C
Details / Remove — Opens a menu to either view plugin details or uninstall the plugin.

Creating New Plugins

In addition to using pre-built plugins, you can create your own plugins for a wide range of purposes. In this section, you’ll create a simple plugin that inserts a new script into ServerScriptService without the default “Hello world!” print function.

Saving a Plugin Script

  1. All plugins start from a Script, so create a new instance inside ServerStorage.
  2. Rename the script EmptyScriptAdder.
  1. Right-click on the script and select Save as Local Plugin.
  2. Click Save to insert the plugin script into your plugins folder. The Output window will indicate that the plugin was successfully saved and “Hello world!” will also appear in the output — this is actually the plugin running for the first time.

Adding a Toolbar Button

It’s often convenient to hook up plugins to a Studio toolbar button. This can be done through Plugin/CreateToolbar|Plugin:CreateToolbar() and PluginToolbar/CreateButton|PluginToolbar:CreateButton().

  1. Open the EmptyScriptAdder script and delete print("Hello world!").
  2. Copy and paste the following code into the script:
  1. Save the plugin again (right-click EmptyScriptAdder and select Save as Local Plugin). When complete, the button will appear in the Plugins tab of Studio:

Modifying Plugin Behavior

The plugin doesn’t do anything yet, so you’ll need to connect a function to the button’s PluginToolbarButton/Click|Click event which creates a new Script instance, sets its Script/Source|Source property to an empty string, and parents it to ServerScriptService.

Once again, save the plugin via Save as Local Plugin. Now when you click the Create Empty Script plugin button, it inserts a new Script into ServerScriptService.

Supporting Undo/Redo

Undo and redo in Studio are managed by waypoints in ChangeHistoryService. After every action in Studio, such as the user dragging a part or inserting a new object, Studio automatically adds a waypoint. When you undo an action, Studio goes back to its last waypoint and undoes everything that happened afterward.

The exception with plugins is that they do not add new waypoints by default. If a plugin makes a change to a place and the user activates Undo, Studio will undo the last non-plugin action and everything the plugin did.

To make sure Studio can cleanly undo a plugin’s action:

  1. Reference ChangeHistoryService on the first line.
  2. Call ChangeHistoryService/SetWaypoint|SetWaypoint() in the final line of the onNewScriptButtonClicked() function.

Using a Selection

Plugins can use the Selection service to find out what objects the user has selected. The following modification checks if the user has anything selected and creates the new script as its child, instead of inside ServerScriptService.

Publishing to Roblox

Just like places and models, plugins can be published to Roblox to make them easy to share and install.

  1. Right-click on the plugin script and select Publish as Plugin from the menu.
  1. If desired, upload a 512×512 image by clicking the image in the upper-left corner of the window.
  2. Enter a title and description for the plugin, making sure you clearly express what the plugin does.
  3. For the Creator field, select an option:
    • Select Me to retain personal ownership.
    • Select a articles/Group Games|group to collaborate on the plugin with members of that group.
  4. If you want the plugin to be visible to other developers in the marketplace and Toolbox, click the Sales button in the left column and toggle on the Sale option.
  5. When ready, click the Submit button.
Tags:
  • ui
  • coding
  • plugin
  • studio