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.
Making a Plugin
A plugin is made from a collection of Roblox objects. To make a plugin, the objects in the plugin should be selected in the Explorer and then either saved as an rbxm (by selecting "Save to File") or published online (by selecting "Save to Roblox"). Any type of Roblox object can be included in a plugin. In particular, GUI objects (such as Frames, ImageButtons, etc) can be included so plugins can have an interface in the 3d view. Any Script (non-disabled) that is included in the plugin will run when the plugin is loaded.
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")
Publishing a Plugin
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.
Creating a Thumbnail
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.
Installing a Plugin
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.