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.

Update — Gets the latest version of the plugin.
Active — Toggles whether the plugin is active or not.
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.

  1. All plugins start from a Script, so create a new script instance inside ServerStorage.
  2. Rename the script EmptyScriptAdder.
  1. Right-click on the script and select Save as Local Plugin.
  1. Click Save. This will insert the plugin into your plugins folder.

Adding a Toolbar Button

It’s often convenient to hook up plugins to a Studio toolbar button. For this, you’ll need to call the Plugin/CreateToolbar|Plugin:CreateToolbar() and PluginToolbar/CreateButton|PluginToolbar:CreateButton() functions.

  1. Open the EmptyScriptAdder script and delete print("Hello world!").
  2. Copy and paste the following code into the script:
  1. Save the plugin as before (right-click the script 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 include additional code which creates a Script instance and sets the Script/Source property to an empty string:

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 catch 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 all of the things the plugin did.

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

  1. Add a local variable for ChangeHistoryService called ChangeHistoryService.
  2. Call ChangeHistoryService/SetWaypoint|SetWaypoint() in the final line of the onNewScriptButtonClicked() function:

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 in Studio 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.

Other Plugin Examples

Insert Empty Folder

Plugins can use the Selection service to find out what objects the user has selected. The following plugin script adds a new toolbar button which checks if the user has anything selected and adds a new Folder to that selection.

  • ui
  • coding
  • plugin
  • studio