A plugin (sometimes refered to as add-on) adds features or functionality to Roblox Studio. For example, the Animation Editor plugin adds a tool to quickly and easily make animations as opposed to having to define keyframes and poses manually in the workspace.
To make a model you can either group existing objects together or inserting a Folder object.
Since the plugin is a model, it can hold any arbitrary Roblox object (along with a script to setup the plugin). For example, one could include other scripts or even a model of parts to copy and insert into the workspace.
The most important part of a plugin is the script. When Studio launches it will search through the active plugins for scripts where the Disabled property is false and then run them. Note that scripts added while Studio is running will not be executed (they must already be part of the plugin at launch). A plugin will not run Local Scripts.
In previous versions of Roblox a Plugin Object had to be created to call any of the relevant functions. Now, plugin is a global keyword when scripting. PluginManager():CreatePlugin() is no longer necessary to create a Plugin object and should not be used.
Plugins can save and load information to save data between Studio sessions. This can be useful for storing configuration values for your plugin so the user does not have to reset them every time Studio is launched.
SetSetting(string key, luaValue value) - Returns nil. They key needs to be unique per plugin. Note that all plugins installed as .rbxm models share a settings namespace, so these plugins should not have keys that share the same name. Plugins installed through the manager on the other hand will each have private storage, so these plugins can have settings that share names with settings from other plugins.
GetSetting(string key) - Returns the previously stored setting with the given key. If no setting is found, then will return nil.
local hasLoaded = plugin:GetSetting("pluginHasLoaded") if not hasLoaded then print("Welcome to the plugin! I see this is the first time you are using this plugin, so let me give you some tips...") plugin:SetSetting("pluginHasLoaded", true) end -- rest of code here...
Plugins can use Roblox decals as icons for buttons in the toolbar. After uploading the decal make note of the asset id. When creating the button, the third parameter accepts the url to your asset:
local button = toolbar:CreateButton( "Button", "Press me", "http://www.roblox.com/asset/?id=145329596"
print("Loading Block Identifier...") -- Check if user has loaded plugin before local hasLoaded = plugin:GetSetting("pluginHasLoaded") if not hasLoaded then print("Welcome to the Block Identifier. To use this plugin, click on the button in the addon bar, then click on the object you want to inspect.") plugin:SetSetting("pluginHasLoaded", true) end -- Setup Toolbar local toolbar = plugin:CreateToolbar("Block Identifier") -- Setup button local button = toolbar:CreateButton( "Button", "Press me", "http://www.roblox.com/asset/?id=145723965" ) button.Click:connect(function() print("Plugin is now active") plugin:Activate(true) -- Neccessary to listen to mouse input end) -- Setup mouse local mouse = plugin:GetMouse() mouse.Button1Down:connect(function() -- Binds function to left click local target = mouse.Target if target then print("Target: " .. target.Name) end print("X: " .. mouse.X .. " Y: " .. mouse.Y) end) print("Finished Loading Block Identifier")
A plugin can be exported in one of two ways. The model can be exported as .rbxm by right clicking on it and selecting Save to File. This will make a local file that you can manually put into the Roblox plugins folder.
Alternatively, the model can be published directly to Roblox where other developers can download and use it. To do this right click on the model in Studio and select Publish as Plugin. This will launch a new window where you can upload the model as a new plugin or overwrite an existing one.
Plugins can have an associated thumbnail to display in the Catalog and Plugin Manager. To set the thumbnail for one of your plugins, log into the Roblox website, navigate to the Develop tab and select Plugins. Choose Configure from the edit button's dropdown menu. Uploading a thumbnail image costs 20.
Plugins can be added to Studio by either importing the model or installing the plugin through the Manage Plugins Tool. To import a plugin as a Model the .rbxm can be put directly into the plugins folder. To open the plugins folder, in studio navigate to Tools -> Open Plugins Folder. If you are using the ribbon layout, select the Add-Ons tab and click on Plugins Folder.
To install a plugin through the manager, navigate to Tools -> Manage Plugins. This will open a new tab in Studio where you can see all the plugins you have installed. Plugins can be activated, deactivated, and uninstalled from here. Clicking on the Find Plugins button will directly navigate to the plugins section of the Roblox catalog.