Skip to content

Class · inherits Instance

Plugin

Official docs ↗

The main object responsible for creating custom Studio widgets, toolbars, buttons, and other plugin UI elements.

About Plugin

Plugin is the main object responsible for creating custom Studio widgets, plugin toolbars, plugin buttons, and more. The Plugin object can be accessed through the RobloxGlobals.plugin global reference in a Script that is executed as a plugin.

Properties 2

  • CollisionEnabled: booleanReadOnlyNotReplicatedReturns whether the user has enabled Collisions in Studio's toolbar.
  • GridSize: floatReadOnlyNotReplicatedReturns the grid snapping size the user has set in Studio.

    Returns the grid snapping size the user has set in Studio's toolbar. Note that this property may have slight rounding errors; for example it may be 0.0099999997764826 for a user setting of 0.01, or 0.4000000059604645 for a user setting of 0.4.

Methods 26

  • Activate(exclusiveMouse: boolean) → ()PluginSets the state of the calling plugin to activated.

    This method sets the state of the calling plugin to activated. Activating the plugin allows mouse control through the GetMouse() method.

    At any given time, there are either 0 or 1 activated plugins. Activating a plugin will deactivate all other plugins and they will receive a Deactivation event.

    See Also

    • IsActivatedWithExclusiveMouse() which returns true if the plugin is currently active with an exclusive mouse, after having been activated via this method.
    • Unloading which fires immediately before the plugin is unloaded or reloaded via uninstallation, deactivation, or updating.
  • CreateDockWidgetPluginGuiAsync(pluginGuiId: string, dockWidgetPluginGuiInfo: DockWidgetPluginGuiInfo) → DockWidgetPluginGuiYieldsPluginCreates a DockWidgetPluginGui given a DockWidgetPluginGuiInfo.

    This method creates a new DockWidgetPluginGui from the given DockWidgetPluginGuiInfo. The first parameter, pluginGuiId, should be a unique and consistent string. It is used to save the state of the widget's dock state and other internal details.

  • CreatePluginAction(actionId: string, text: string, statusTip: string, iconName: string, allowBinding: boolean = true) → PluginActionPluginCreates a PluginAction which represents a generic performable action in Studio with no directly‑associated PluginToolbarButton.

    This method creates a PluginAction which represents a generic performable action in Studio with no directly‑associated PluginToolbarButton.

    See also CreatePluginMenu() which creates a Studio PluginMenu that can display a list of PluginActions.

  • CreatePluginMenu(id: string, title: string, icon: string) → PluginMenuPluginCreates a new plugin menu.

    This function creates a new PluginMenu which is a context menu that can be shown in Studio that displays a list of PluginActions and also supports submenus.

  • CreateToolbar(name: string) → PluginToolbarPluginCreates a new PluginToolbar with the given name.

    This method creates a new PluginToolbar with the given name. The toolbar can then be used to create plugin buttons.

  • Deactivate() → ()PluginDeactivates the plugin.

    Deactivates the plugin. This will disengage the associated PluginMouse if it has been activated.

    See Also

    • Activate() which sets the state of the calling plugin to activated.
    • Deactivation which fires when the plugin is deactivated.
    • Unloading which fires immediately before the plugin is unloaded or reloaded via uninstallation, deactivation, or updating.
  • GetJoinMode() → JointCreationModePluginReturns the JointCreationMode the user has set in Studio's toolbar.
  • GetMouse() → PluginMousePluginReturns a Mouse that can be used while the plugin is active.

    This method returns a PluginMouse that can be used while the plugin is active through Activate().

  • GetSelectedRibbonTool() → RibbonToolPluginReturns the currently selected RibbonTool.

    This method returns the currently selected RibbonTool.

  • GetSetting(key: string) → VariantPluginRetrieves a previously stored value with the given key, or nil if the given key doesn't exist.

    Retrieves a previously stored value with the given key, or nil if the given key doesn't exist.

    Because multiple instances of the same plugin can run simultaneously (for example, if multiple Studio windows are open), you shouldn't depend on this value staying the same over time. The other plugin instances can update the setting at any time.

    This call can silently fail and return nil if multiple instances of the same plugin are actively reading and writing data. If your plugin expects to write to settings frequently, you should double-check the returned value from this call after a short while to distinguish between a setting being temporarily unavailable and a setting not existing.

  • ImportFbxAnimationAsync(rigModel: Instance, isR15: boolean = true) → InstanceYieldsPluginPrompts the user to open a .fbx animation file that can be loaded onto the rigModel, then proceeds to insert the animation as a KeyframeSequence in the Workspace.

    This function prompts the user to open a .fbx animation file that can be loaded onto the rigModel, then proceeds to insert the animation as a KeyframeSequence in the Workspace.

  • ImportFbxRigAsync(isR15: boolean = true) → InstanceYieldsPluginPrompts the user to open a .fbx file, uploads the individual components of the model as meshes, and generates a character rig for use in animation, which is loaded into the Workspace.
  • Intersect(objects: Instances) → InstancePluginIntersects the given parts and returns the resulting IntersectOperation.
  • IsActivated() → booleanPluginReturns true if this plugin is currently active, after having been activated via the Activate() function.

    This function returns true if this plugin is currently active, after having been activated via the Activate() function.

  • IsActivatedWithExclusiveMouse() → booleanPluginReturns true if this plugin is currently active with an exclusive mouse.

    This function returns true if this plugin is currently active with an exclusive mouse, after having been activated via the Activate() function. If this returns true, a PluginMouse can be retrieved via GetMouse().

    See Also

    • Deactivation which fires when the plugin is deactivated.
    • Unloading which fires immediately before the plugin is unloaded or reloaded via uninstallation, deactivation, or updating.
  • Negate(objects: Instances) → InstancesPluginNegates the given parts and returns the resulting NegateOperations.
  • OpenWikiPage(url: string) → ()PluginOpens the context help window to the wiki page that url links to.
  • PromptForExistingAssetId(assetType: string) → int64YieldsPluginOpens a window in Roblox Studio that prompts the user to select an existing AssetType.Animation asset. The assetType parameter must be Animation; other values are not supported and cause an error.

    Opens a window in Roblox Studio that prompts the user to select an existing animation asset from the user's inventory. Pass Animation as the assetType argument.

    Returns the selected animation asset ID as an int64, or -1 if the user closes the dialog without selecting an asset. If assetType is not Animation, this method errors.

  • PromptForExistingAssetIdAsync(assetType: string) → int64YieldsPluginOpens a window in Roblox Studio that prompts the user to select an existing AssetType.Animation asset. The assetType parameter must be Animation; other values are not supported and cause an error.

    Opens a window in Roblox Studio that prompts the user to select an existing animation asset from the user's inventory. Pass Animation as the assetType argument.

    Returns the selected animation asset ID as an int64, or -1 if the user closes the dialog without selecting an asset. If assetType is not Animation, this method errors.

  • PromptSaveSelectionAsync(suggestedFileName: string) → booleanYieldsPluginPrompts the user to save their current selection with the specified file name.

    Prompts the user to save their current selection with the specified file name. Returns true if the user did save the file.

  • SaveSelectedToRoblox() → ()PluginOpens an upload window for the user's current selection.
  • SelectRibbonTool(tool: RibbonTool, position: UDim2) → ()PluginActivates the specified Roblox Studio tool.

    Activates the specified Roblox Studio tool. If the tool opens a window, the position parameter specifies where it should be shown on the screen.

    An object must be selected in order for this to work correctly. Also note that altering the scale fields of the position property will not affect the dialog popups.

  • Separate(objects: Instances) → InstancesPluginSeparates the given UnionOperations and returns the resulting parts.
  • SetSetting(key: string, value: Variant) → ()PluginStores a given value for later use under the given key. The value will persist even after Studio is closed.

    Stores a given value for later use under the given key. The value will persist even after Roblox Studio is closed. These settings are saved in .json format as a map with string keys. Arrays are automatically converted to maps by converting the numeric keys to strings first.

    Note that the .json format imposes additional restrictions, including the following characters which can corrupt the settings file:

    • Backslashes (\) in keys or values, in particular escaped quotes (\").
    • Newlines (\n) in keys.
    • Quotes (") in keys.
    • Periods (.) in keys.

    This call can silently fail if multiple instances of the same plugin are actively reading and writing data. If your plugin expects to write to settings frequently, you may check that the data has been properly written by calling GetSetting().

  • StartDrag(dragData: Dictionary) → ()PluginStarts a drag action given a dictionary of parameters.

    This method initiates a drag action using a dictionary of parameters. The parameters are as follows:

    See also PluginGui.PluginDragEntered, PluginGui.PluginDragMoved, PluginGui.PluginDragDropped, and PluginGui.PluginDragLeft.

  • Union(objects: Instances) → InstancePluginUnions the given parts and returns the resulting UnionOperation.

Events 2

  • DeactivationPlugin.Deactivation:Connect(function())PluginFired when the plugin is deactivated.

    Fired when the Plugin is deactivated. This occurs when either the plugin code calls Deactivate(), or because some other plugin called Activate(), which forces all other plugins to lose their active state.

    See also Unloading which fires immediately before the plugin is unloaded or reloaded via uninstallation, deactivation, or updating.

  • UnloadingPlugin.Unloading:Connect(function())PluginFires immediately before the Plugin stops running.

    This event fires immediately before the Plugin stops running. Plugins are unloaded when disabled, uninstalled, about to be updated, or when the place is closing.

    It enables a plugin to clean up after itself before its scripts stop running, e.g. to remove unnecessary instances from the DataModel. If a plugin does not clean up properly, the old copies will remain. When this occurs, users may be forced to close and reopen the place which is a bad user experience.

    Plugin-related instances such as PluginToolbarButtons, DockWidgetPluginGuis, and PluginGuis are automatically cleaned up when the plugin is unloaded so there is no need to remove them.

Plugin also has every member of Instance. Deprecated and Roblox-only members are hidden.

Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.