Intro to Plugins
Intro to Plugins
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.
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.
- All plugins start from a
Script, so create a new script instance inside
- Rename the script EmptyScriptAdder.
- Right-click on the script and select Save as Local Plugin.
- Click Save. This will insert the plugin into your plugins folder.
This is actually the plugin running for the first time. Whenever you save a plugin in this way, it will refresh and run.
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
- Open the EmptyScriptAdder script and delete
- Copy and paste the following code into the script:
- 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
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:
- Add a local variable for
ChangeHistoryService/SetWaypoint|SetWaypoint()in the final line of the
ChangeHistoryService/SetWaypoint|SetWaypoint()after every individual step where the user should be allowed to roll back to.
Publishing to Roblox
Just like places and models, plugins can be published to Roblox to make them easy to share and install.
- Right-click on the plugin script in Studio and select Publish as Plugin… from the menu.
- If desired, upload a 512×512 image by clicking the image in the upper-left corner of the window.
- Enter a title and description for the plugin, making sure you clearly express what the plugin does.
- For the Creator field, select an option:
- Select Me to retain personal ownership.
- Select a
articles/Group Games|groupto collaborate on the plugin with members of that group.
- 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.
- When ready, click the Submit button.
- Click the Overwrite an existing asset... button in the lower-left area of the window.
- Locate and select the plugin to overwrite, then click Submit to overwrite it.
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.