Roblox UtilitiesDevlHub Roblox Documentation

Class

Plugin

NotCreatable
Inherits
Instance › Object
Memory category
Instances

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

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 4#

CollisionEnabledbooleanReturns whether the user has enabled Collisions in Studio's toolbar.ReadSafeReadOnlyNotReplicated
DisableUIDragDetectorDragsbooleanIf true, toolbars and buttons for the plugin will ignore dragging related to a UIDragDetector instance.Read: RobloxScriptSecurityWrite: RobloxScriptSecurityReadSafe
GridSizefloatReturns the grid snapping size the user has set in Studio.ReadSafeReadOnlyNotReplicated
IsDebuggablebooleanIndicates whether the plugin's scripts can be debugged in Studio.Read: RobloxScriptSecurityWrite: RobloxScriptSecurityReadSafe

CollisionEnabled: boolean#

ReadOnlyNotReplicatedReadSafe

Returns whether the user has enabled Collisions in Studio's toolbar.

DisableUIDragDetectorDrags: boolean#

Read: RobloxScriptSecurityWrite: RobloxScriptSecurityReadSafe

If true, toolbars and buttons for the plugin will ignore dragging related to a UIDragDetector instance.

GridSize: float#

ReadOnlyNotReplicatedReadSafe

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.

IsDebuggable: boolean#

Read: RobloxScriptSecurityWrite: RobloxScriptSecurityReadSafe

Indicates whether the plugin's scripts can be debugged in Studio. This property is not accessible through scripts.

Methods 32#

ActivateSets the state of the calling plugin to activated.PluginSecurity security
CreateDockWidgetPluginGuiCreates a DockWidgetPluginGui given a DockWidgetPluginGuiInfo.PluginSecurity securityDeprecatedYields
CreateDockWidgetPluginGuiAsyncCreates a DockWidgetPluginGui given a DockWidgetPluginGuiInfo.PluginSecurity securityYields
CreatePluginActionCreates a PluginAction which represents a generic performable action in Studio with no directly‑associated PluginToolbarButton.PluginSecurity security
CreatePluginMenuCreates a new plugin menu.PluginSecurity security
CreateToolbarCreates a new PluginToolbar with the given name.PluginSecurity security
DeactivateDeactivates the plugin.PluginSecurity security
GetJoinModeReturns the JointCreationMode the user has set in Studio's toolbar.PluginSecurity security
GetMouseReturns a Mouse that can be used while the plugin is active.PluginSecurity security
GetSelectedRibbonToolReturns the currently selected RibbonTool.PluginSecurity security
GetSettingRetrieves a previously stored value with the given key, or nil if the given key doesn't exist.PluginSecurity security
GetStudioUserIdReturns the Studio user's userId if they're logged in, otherwise returns 0.PluginSecurity security
ImportFbxAnimationPrompts 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.PluginSecurity securityYields
ImportFbxAnimationAsyncPrompts 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.PluginSecurity securityYields
ImportFbxRigPrompts 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.PluginSecurity securityDeprecatedYields
ImportFbxRigAsyncPrompts 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.PluginSecurity securityYields
IntersectIntersects the given parts and returns the resulting IntersectOperation.PluginSecurity security
IsActivatedReturns true if this plugin is currently active, after having been activated via the Activate() function.PluginSecurity security
IsActivatedWithExclusiveMouseReturns true if this plugin is currently active with an exclusive mouse.PluginSecurity security
NegateNegates the given parts and returns the resulting NegateOperations.PluginSecurity security
OpenScriptUsed to open the given script instance in an editor window, in Roblox studio, at the given line. If no line is given as an argument it will default to 1.PluginSecurity security
OpenWikiPageOpens the context help window to the wiki page that url links to.PluginSecurity security
PromptForExistingAssetIdOpens 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.PluginSecurity securityYields
PromptForExistingAssetIdAsyncOpens 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.PluginSecurity securityYields
PromptSaveSelectionPrompts the user to save their current selection with the specified file name.PluginSecurity securityDeprecatedYields
PromptSaveSelectionAsyncPrompts the user to save their current selection with the specified file name.PluginSecurity securityYields
SaveSelectedToRobloxOpens an upload window for the user's current selection.PluginSecurity security
SelectRibbonToolActivates the specified Roblox Studio tool.PluginSecurity security
SeparateSeparates the given UnionOperations and returns the resulting parts.PluginSecurity security
SetSettingStores a given value for later use under the given key. The value will persist even after Studio is closed.PluginSecurity security
StartDragStarts a drag action given a dictionary of parameters.PluginSecurity security
UnionUnions the given parts and returns the resulting UnionOperation.PluginSecurity security

Activate(exclusiveMouse: boolean): ()#

PluginSecurity security

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.
NameTypeDefaultDescription
exclusiveMousebooleanA boolean specifying whether to activate the plugin with exclusive mouse. If true, a PluginMouse can be retrieved via GetMouse().
Returns
  • ()

CreateDockWidgetPluginGui(pluginGuiId: string, dockWidgetPluginGuiInfo: DockWidgetPluginGuiInfo): DockWidgetPluginGui#

YieldsDeprecatedPluginSecurity securityDeprecated

Deprecated. This method has been superseded by CreateDockWidgetPluginGuiAsync().

This method has been superseded by CreateDockWidgetPluginGuiAsync(). It creates a new DockWidgetPluginGui from the given DockWidgetPluginGuiInfo.

NameTypeDefaultDescription
pluginGuiIdstringA unique and consistent identifier used to storing the widget's dock state and other internal details.
dockWidgetPluginGuiInfoDockWidgetPluginGuiInfoDescribes the DockWidgetPluginGui to create (initial state, size, etc).

CreateDockWidgetPluginGuiAsync(pluginGuiId: string, dockWidgetPluginGuiInfo: DockWidgetPluginGuiInfo): DockWidgetPluginGui#

YieldsPluginSecurity security

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.

NameTypeDefaultDescription
pluginGuiIdstringA unique and consistent identifier used to storing the widget's dock state and other internal details.
dockWidgetPluginGuiInfoDockWidgetPluginGuiInfoDescribes the DockWidgetPluginGui to create (initial state, size, etc).

CreatePluginAction(actionId: string, text: string, statusTip: string, iconName: string, allowBinding: boolean = true): PluginAction#

PluginSecurity security

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.

NameTypeDefaultDescription
actionIdstringMust be a unique string that identifies this PluginAction from others.
textstringThe displayed name of the action.
statusTipstringThe displayed description of the action.
iconNamestringThe name of the icon used to display the plugin.
allowBindingbooleantrueWhether the PluginAction will be hidden from Studio's shortcuts view. Useful for contextual actions. Defaults to true.

CreatePluginMenu(id: string, title: string, icon: string): PluginMenu#

PluginSecurity security

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.

NameTypeDefaultDescription
idstringUnique ID for the menu.
titlestringThe text to be displayed when used as a submenu.
iconstringThe icon to be displayed when used as a submenu.
Returns

CreateToolbar(name: string): PluginToolbar#

PluginSecurity security

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

NameTypeDefaultDescription
namestringThe visible text on the toolbar, labeling the group of buttons contained within.

Deactivate(): ()#

PluginSecurity security

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.
Returns
  • ()

GetJoinMode(): JointCreationMode#

PluginSecurity security

Returns the JointCreationMode the user has set in Studio's toolbar.

GetMouse(): PluginMouse#

PluginSecurity security

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

GetSelectedRibbonTool(): RibbonTool#

PluginSecurity security

This method returns the currently selected RibbonTool.

Returns

GetSetting(key: string): Variant#

PluginSecurity security

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.

NameTypeDefaultDescription
keystringThe string key that was previously passed to SetSetting().
Returns
  • Variant

GetStudioUserId(): int64#

DeprecatedPluginSecurity security

Returns the Studio user's userId if they're logged in, otherwise returns 0.

Returns
  • int64

ImportFbxAnimation(rigModel: Instance, isR15: boolean = true): Instance#

YieldsDeprecatedPluginSecurity security

This method 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 named "ImportedAnimation" in the Workspace. The isR15 parameter determines whether the file is interpreted as an R15 rig and defaults to true.

Returns the resulting KeyframeSequence instance. Errors if rigModel is nil or if the user cancels the file dialog without selecting a file.

NameTypeDefaultDescription
rigModelInstanceThe rig model that the imported animation will be applied to.
isR15booleantrueWhether the animation file should be interpreted as an R15 rig. Defaults to true.
Returns

ImportFbxAnimationAsync(rigModel: Instance, isR15: boolean = true): Instance#

YieldsPluginSecurity security

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.

NameTypeDefaultDescription
rigModelInstanceThe rig model that the imported animation will be applied to.
isR15booleantrueWhether the animation file should be interpreted as an R15 rig. Defaults to true.
Returns

ImportFbxRig(isR15: boolean = true): Instance#

YieldsDeprecatedPluginSecurity securityDeprecated

Deprecated. This method has been superseded by ImportFbxRigAsync().

This method has been superseded by ImportFbxRigAsync(). It prompts 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.

NameTypeDefaultDescription
isR15booleantrueWhether the rig file should be interpreted as R15. Defaults to true.
Returns

ImportFbxRigAsync(isR15: boolean = true): Instance#

YieldsPluginSecurity security

Prompts 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.

NameTypeDefaultDescription
isR15booleantrueWhether the rig file should be interpreted as R15. Defaults to true.
Returns

Intersect(objects: Instances): Instance#

PluginSecurity security

Intersects the given parts and returns the resulting IntersectOperation.

NameTypeDefaultDescription
objectsInstancesThe array of BaseParts to intersect.
Returns

IsActivated(): boolean#

PluginSecurity security

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

Returns
  • boolean — A boolean indicating whether the plugin is currently active.

IsActivatedWithExclusiveMouse(): boolean#

PluginSecurity security

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.
Returns
  • boolean — Whether this plugin is currently active with an exclusive mouse.

Negate(objects: Instances): Instances#

PluginSecurity security

Negates the given parts and returns the resulting NegateOperations.

NameTypeDefaultDescription
objectsInstancesThe array of BaseParts to negate.
Returns
  • Instances

OpenScript(script: LuaSourceContainer, lineNumber: int = 1): ()#

DeprecatedPluginSecurity security

Used to open the given script instance in an editor window, in Roblox studio, at the given line. If no line is given as an argument it will default to 1.

Prefer ScriptEditorService:OpenScriptDocumentAsync(), which provides better integration with other script editor APIs and is more extensible.

NameTypeDefaultDescription
scriptLuaSourceContainerThe LuaSourceContainer script instance to open.
lineNumberint1The line number to navigate to in the editor. Defaults to 1.
Returns
  • ()

OpenWikiPage(url: string): ()#

PluginSecurity security

Opens the context help window to the wiki page that url links to.

NameTypeDefaultDescription
urlstringThe URL of the wiki/documentation page to open.
Returns
  • ()

PromptForExistingAssetId(assetType: string): int64#

YieldsPluginSecurity security

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.

NameTypeDefaultDescription
assetTypestringThe asset type to browse. Only Animation is supported.
Returns
  • int64

PromptForExistingAssetIdAsync(assetType: string): int64#

YieldsPluginSecurity security

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.

NameTypeDefaultDescription
assetTypestringThe asset type to browse. Only Animation is supported.
Returns
  • int64

PromptSaveSelection(suggestedFileName: string): boolean#

YieldsDeprecatedPluginSecurity securityDeprecated

Deprecated. This method has been superseded by PromptSaveSelectionAsync().

This method has been superseded by PromptSaveSelectionAsync(). It prompts the user to save their current selection with the specified file name and returns whether the user completed the save.

NameTypeDefaultDescription
suggestedFileNamestringThe default file name shown in the save dialog. Defaults to an empty string.
Returns
  • boolean

PromptSaveSelectionAsync(suggestedFileName: string): boolean#

YieldsPluginSecurity security

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

NameTypeDefaultDescription
suggestedFileNamestringThe default file name shown in the save dialog. Defaults to an empty string.
Returns
  • boolean

SaveSelectedToRoblox(): ()#

PluginSecurity security

Opens an upload window for the user's current selection.

Returns
  • ()

SelectRibbonTool(tool: RibbonTool, position: UDim2): ()#

PluginSecurity security

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.

NameTypeDefaultDescription
toolRibbonToolThe RibbonTool to activate.
positionUDim2The UDim2 screen position at which to show the tool's dialog window, if applicable.
Returns
  • ()

Separate(objects: Instances): Instances#

PluginSecurity security

Separates the given UnionOperations and returns the resulting parts.

NameTypeDefaultDescription
objectsInstancesThe array of UnionOperations to separate.
Returns
  • Instances

SetSetting(key: string, value: Variant): ()#

PluginSecurity security

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().

NameTypeDefaultDescription
keystringThe string key to store the value under.
valueVariantThe value to store. Must be JSON-serializable (string, number, boolean, table, or nil).
Returns
  • ()

StartDrag(dragData: Dictionary): ()#

PluginSecurity security

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

Name Type Default Description
Sender string "" Identifies the source of the drag action to the drop target
MimeType string "" The MIME type of Data.
Data string "" Information about the drag action, for example what is being dragged. Should be used by the drop target.
MouseIcon Datatype.Content "" The icon to use for the mouse cursor during the drag. If empty, uses the default cursor.
DragIcon Datatype.Content "" An image to render under the mouse cursor during the drag. This should represent the item being dragged.
HotSpot Datatype.Vector2 Datatype.Vector2.new(0, 0) The pixel offset from the top-left where the cursor should "hold" the DragIcon.

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

NameTypeDefaultDescription
dragDataDictionaryA dictionary describing the drag, including fields such as Sender, MimeType, Data, MouseIcon, DragIcon, and HotSpot.
Returns
  • ()

Union(objects: Instances): Instance#

PluginSecurity security

Unions the given parts and returns the resulting UnionOperation.

NameTypeDefaultDescription
objectsInstancesThe array of BaseParts to union together.
Returns

Events 2#

DeactivationFired when the plugin is deactivated.PluginSecurity security
UnloadingFires immediately before the Plugin stops running.PluginSecurity security

Deactivation()#

PluginSecurity security

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.

Unloading()#

PluginSecurity security

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.

Inherited members#

Inherited from Instance 58
Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed