# Plugin

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Tags: Not creatable
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/Plugin/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/Plugin

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

## Properties

### UsesAssetInsertionDrag

```luau
Plugin.UsesAssetInsertionDrag: boolean
```

- Tags: Hidden, Not replicated, Roblox script security

### CollisionEnabled

```luau
Plugin.CollisionEnabled: boolean
```

- Tags: Read only

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

### DisableUIDragDetectorDrags

```luau
Plugin.DisableUIDragDetectorDrags: boolean
```

- Tags: Roblox script security

If `true`, toolbars and buttons for the plugin will ignore dragging related to a [`UIDragDetector`](https://rapi.sleaze.dev/classes/UIDragDetector.md) instance.

### GridSize

```luau
Plugin.GridSize: number
```

- Tags: Read only

Returns the grid snapping size the user has set in Studio.

### HostDataModelType

```luau
Plugin.HostDataModelType: Enum.StudioDataModelType
```

- Tags: Hidden, Read only, Roblox script security

### HostDataModelTypeIsCurrent

```luau
Plugin.HostDataModelTypeIsCurrent: boolean
```

- Tags: Hidden, Read only, Roblox script security

### IsDebuggable

```luau
Plugin.IsDebuggable: boolean
```

- Tags: Roblox script security

Indicates whether the plugin's scripts can be debugged in Studio.

### MultipleDocumentInterfaceInstance

```luau
Plugin.MultipleDocumentInterfaceInstance: MultipleDocumentInterfaceInstance
```

- Tags: Hidden, Read only, Roblox script security

## Methods

### Activate

```luau
Plugin:Activate(exclusiveMouse: boolean)
```

- Tags: Plugin security

Sets the state of the calling plugin to activated.

Parameters:

- `exclusiveMouse`: A boolean specifying whether to activate the plugin with exclusive mouse. If `true`, a [`PluginMouse`](https://rapi.sleaze.dev/classes/PluginMouse.md) can be retrieved via [`GetMouse()`](https://rapi.sleaze.dev/classes/Plugin.md).

### CreateDockWidgetPluginGuiAsync

```luau
Plugin:CreateDockWidgetPluginGuiAsync(pluginGuiId: string, dockWidgetPluginGuiInfo: DockWidgetPluginGuiInfo): DockWidgetPluginGui
```

- Tags: Yields, Plugin security

Creates a [`DockWidgetPluginGui`](https://rapi.sleaze.dev/classes/DockWidgetPluginGui.md) given a [`DockWidgetPluginGuiInfo`](https://rapi.sleaze.dev/index/types/DockWidgetPluginGuiInfo.md).

Parameters:

- `pluginGuiId`: A unique and consistent identifier used to storing the widget's dock state and other internal details.
- `dockWidgetPluginGuiInfo`: Describes the [`DockWidgetPluginGui`](https://rapi.sleaze.dev/classes/DockWidgetPluginGui.md) to create (initial state, size, etc).

### CreatePluginAction

```luau
Plugin:CreatePluginAction(actionId: string, text: string, statusTip: string, iconName: string? = "", allowBinding: boolean? = true): PluginAction
```

- Tags: Plugin security

Creates a [`PluginAction`](https://rapi.sleaze.dev/classes/PluginAction.md) which represents a generic performable action in Studio with no directly‑associated [`PluginToolbarButton`](https://rapi.sleaze.dev/classes/PluginToolbarButton.md).

Parameters:

- `actionId`: Must be a unique string that identifies this PluginAction from others.
- `text`: The displayed name of the action.
- `statusTip`: The displayed description of the action.
- `iconName`: The name of the icon used to display the plugin.
- `allowBinding`: Whether the [`PluginAction`](https://rapi.sleaze.dev/classes/PluginAction.md) will be hidden from Studio's shortcuts view. Useful for contextual actions. Defaults to true.

### CreatePluginMenu

```luau
Plugin:CreatePluginMenu(id: string, title: string? = "", icon: string? = ""): PluginMenu
```

- Tags: Plugin security

Creates a new plugin menu.

Parameters:

- `id`: Unique ID for the menu.
- `title`: The text to be displayed when used as a submenu.
- `icon`: The icon to be displayed when used as a submenu.

### CreateQWidgetPluginGui

```luau
Plugin:CreateQWidgetPluginGui(pluginGuiId: string, pluginGuiOptions: { [string]: any }): QWidgetPluginGui
```

- Tags: Yields, Roblox script security

### CreateToolbar

```luau
Plugin:CreateToolbar(name: string): PluginToolbar
```

- Tags: Plugin security

Creates a new [`PluginToolbar`](https://rapi.sleaze.dev/classes/PluginToolbar.md) with the given name.

Parameters:

- `name`: The visible text on the toolbar, labeling the group of buttons contained within.

### Deactivate

```luau
Plugin:Deactivate()
```

- Tags: Plugin security

Deactivates the plugin.

### FinishFullLoading

```luau
Plugin:FinishFullLoading(payload: any)
```

- Tags: Custom Lua state, Roblox script security

### GetItem

```luau
Plugin:GetItem(key: string, defaultValue: any): any
```

- Tags: Roblox script security

### GetJoinMode

```luau
Plugin:GetJoinMode(): Enum.JointCreationMode
```

- Tags: Plugin security

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

### GetMouse

```luau
Plugin:GetMouse(): PluginMouse
```

- Tags: Plugin security

Returns a [`Mouse`](https://rapi.sleaze.dev/classes/Mouse.md) that can be used while the plugin is active.

### GetPluginComponent

```luau
Plugin:GetPluginComponent(name: string): any
```

- Tags: Custom Lua state, Roblox script security

### GetPreinitPayload

```luau
Plugin:GetPreinitPayload(): any
```

- Tags: Custom Lua state, Roblox script security

### GetSelectedRibbonTool

```luau
Plugin:GetSelectedRibbonTool(): Enum.RibbonTool
```

- Tags: Plugin security

Returns the currently selected `RibbonTool`.

### GetSetting

```luau
Plugin:GetSetting(key: string): any
```

- Tags: Plugin security

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

Parameters:

- `key`: The string key that was previously passed to [`SetSetting()`](https://rapi.sleaze.dev/classes/Plugin.md).

### GetUri

```luau
Plugin:GetUri(): { [string]: any }
```

- Tags: Roblox script security

### ImportFbxAnimationAsync

```luau
Plugin:ImportFbxAnimationAsync(rigModel: Instance, isR15: boolean? = true): Instance
```

- Tags: Yields, Plugin security

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`](https://rapi.sleaze.dev/classes/KeyframeSequence.md) in the [`Workspace`](https://rapi.sleaze.dev/classes/Workspace.md).

Parameters:

- `rigModel`: The rig model that the imported animation will be applied to.
- `isR15`: Whether the animation file should be interpreted as an R15 rig. Defaults to `true`.

### ImportFbxRigAsync

```luau
Plugin:ImportFbxRigAsync(isR15: boolean? = true): Instance
```

- Tags: Yields, Plugin 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`](https://rapi.sleaze.dev/classes/Workspace.md).

Parameters:

- `isR15`: Whether the rig file should be interpreted as R15. Defaults to `true`.

### Intersect

```luau
Plugin:Intersect(objects: { Instance }): Instance
```

- Tags: Plugin security

Intersects the given parts and returns the resulting [`IntersectOperation`](https://rapi.sleaze.dev/classes/IntersectOperation.md).

Parameters:

- `objects`: The array of `BaseParts` to intersect.

### Invoke

```luau
Plugin:Invoke(key: string, ...: any)
```

- Tags: Roblox script security

### IsActivated

```luau
Plugin:IsActivated(): boolean
```

- Tags: Plugin security

Returns `true` if this plugin is currently active, after having been activated via the [`Activate()`](https://rapi.sleaze.dev/classes/Plugin.md) function.

Returns: A boolean indicating whether the plugin is currently active.

### IsActivatedWithExclusiveMouse

```luau
Plugin:IsActivatedWithExclusiveMouse(): boolean
```

- Tags: Plugin security

Returns `true` if this plugin is currently active with an exclusive mouse.

Returns: Whether this plugin is currently active with an exclusive mouse.

### IsLoadedFromProject

```luau
Plugin:IsLoadedFromProject(): boolean
```

- Tags: Roblox script security

### Negate

```luau
Plugin:Negate(objects: { Instance }): { Instance }
```

- Tags: Plugin security

Negates the given parts and returns the resulting `NegateOperations`.

Parameters:

- `objects`: The array of `BaseParts` to negate.

### OnInvoke

```luau
Plugin:OnInvoke(key: string, callback: (...any) -> ...any): Instance
```

- Tags: Roblox script security

### OnInvokeSuspendOverride

```luau
Plugin:OnInvokeSuspendOverride(key: string, callback: (...any) -> ...any): Instance
```

- Tags: Roblox script security

### OnSetItem

```luau
Plugin:OnSetItem(key: string, callback: (...any) -> ...any): Instance
```

- Tags: Roblox script security

### OpenWikiPage

```luau
Plugin:OpenWikiPage(url: string)
```

- Tags: Plugin security

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

Parameters:

- `url`: The URL of the wiki/documentation page to open.

### PauseSound

```luau
Plugin:PauseSound(sound: Instance)
```

- Tags: Roblox script security

### PlaySound

```luau
Plugin:PlaySound(sound: Instance, normalizedTimePosition: number? = 0)
```

- Tags: Roblox script security

### PromptForExistingAssetId

```luau
Plugin:PromptForExistingAssetId(assetType: string): number
```

- Tags: Yields, Plugin security

Opens a window in Roblox Studio that prompts the user to select an existing `AssetType.Animation` asset. The `assetType` parameter must be [`Animation`](https://rapi.sleaze.dev/classes/Animation.md); other values are not supported and cause an error.

Parameters:

- `assetType`: The asset type to browse. Only [`Animation`](https://rapi.sleaze.dev/classes/Animation.md) is supported.

### PromptForExistingAssetIdAsync

```luau
Plugin:PromptForExistingAssetIdAsync(assetType: string): number
```

- Tags: Yields, Plugin security

Opens a window in Roblox Studio that prompts the user to select an existing `AssetType.Animation` asset. The `assetType` parameter must be [`Animation`](https://rapi.sleaze.dev/classes/Animation.md); other values are not supported and cause an error.

Parameters:

- `assetType`: The asset type to browse. Only [`Animation`](https://rapi.sleaze.dev/classes/Animation.md) is supported.

### PromptSaveSelectionAsync

```luau
Plugin:PromptSaveSelectionAsync(suggestedFileName: string? = ""): boolean
```

- Tags: Yields, Plugin security

Prompts the user to save their current selection with the specified file name.

Parameters:

- `suggestedFileName`: The default file name shown in the save dialog. Defaults to an empty string.

### ResumeSound

```luau
Plugin:ResumeSound(sound: Instance)
```

- Tags: Roblox script security

### SaveSelectedToRoblox

```luau
Plugin:SaveSelectedToRoblox()
```

- Tags: Plugin security

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

### SelectRibbonTool

```luau
Plugin:SelectRibbonTool(tool: Enum.RibbonTool, position: UDim2)
```

- Tags: Plugin security

Activates the specified Roblox Studio tool.

Parameters:

- `tool`: The `RibbonTool` to activate.
- `position`: The [`UDim2`](https://rapi.sleaze.dev/index/types/UDim2.md) screen position at which to show the tool's dialog window, if applicable.

### Separate

```luau
Plugin:Separate(objects: { Instance }): { Instance }
```

- Tags: Plugin security

Separates the given `UnionOperations` and returns the resulting parts.

Parameters:

- `objects`: The array of `UnionOperations` to separate.

### SetItem

```luau
Plugin:SetItem(key: string, value: any)
```

- Tags: Roblox script security

### SetReady

```luau
Plugin:SetReady()
```

- Tags: Roblox script security

### SetSetting

```luau
Plugin:SetSetting(key: string, value: any)
```

- Tags: Plugin security

Stores a given value for later use under the given key. The value will persist even after Studio is closed.

Parameters:

- `key`: The string key to store the value under.
- `value`: The value to store. Must be JSON-serializable (string, number, boolean, table, or `nil`).

### StartDecalDrag

```luau
Plugin:StartDecalDrag(decal: Instance)
```

- Tags: Roblox script security

### StartDrag

```luau
Plugin:StartDrag(dragData: { [string]: any })
```

- Tags: Plugin security

Starts a drag action given a dictionary of parameters.

Parameters:

- `dragData`: A dictionary describing the drag, including fields such as `Sender`, `MimeType`, `Data`, `MouseIcon`, `DragIcon`, and `HotSpot`.

### StopAllSounds

```luau
Plugin:StopAllSounds()
```

- Tags: Roblox script security

### Union

```luau
Plugin:Union(objects: { Instance }): Instance
```

- Tags: Plugin security

Unions the given parts and returns the resulting [`UnionOperation`](https://rapi.sleaze.dev/classes/UnionOperation.md).

Parameters:

- `objects`: The array of `BaseParts` to union together.

### CreateDockWidgetPluginGui

```luau
Plugin:CreateDockWidgetPluginGui(pluginGuiId: string, dockWidgetPluginGuiInfo: DockWidgetPluginGuiInfo): DockWidgetPluginGui
```

- Tags: Deprecated, Yields, Plugin security
- Use instead: [`Plugin.CreateDockWidgetPluginGuiAsync`](https://rapi.sleaze.dev/classes/Plugin.md)

**Deprecated:** This method has been superseded by [`CreateDockWidgetPluginGuiAsync()`](https://rapi.sleaze.dev/classes/Plugin.md).

Creates a [`DockWidgetPluginGui`](https://rapi.sleaze.dev/classes/DockWidgetPluginGui.md) given a [`DockWidgetPluginGuiInfo`](https://rapi.sleaze.dev/index/types/DockWidgetPluginGuiInfo.md).

Parameters:

- `pluginGuiId`: A unique and consistent identifier used to storing the widget's dock state and other internal details.
- `dockWidgetPluginGuiInfo`: Describes the [`DockWidgetPluginGui`](https://rapi.sleaze.dev/classes/DockWidgetPluginGui.md) to create (initial state, size, etc).

### GetStudioUserId

```luau
Plugin:GetStudioUserId(): number
```

- Tags: Deprecated, Plugin security

**Deprecated:**

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

### ImportFbxAnimation

```luau
Plugin:ImportFbxAnimation(rigModel: Instance, isR15: boolean? = true): Instance
```

- Tags: Deprecated, Yields, Plugin security
- Use instead: [`Plugin.ImportFbxAnimationAsync`](https://rapi.sleaze.dev/classes/Plugin.md)

**Deprecated:**

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`](https://rapi.sleaze.dev/classes/KeyframeSequence.md) in the [`Workspace`](https://rapi.sleaze.dev/classes/Workspace.md).

Parameters:

- `rigModel`: The rig model that the imported animation will be applied to.
- `isR15`: Whether the animation file should be interpreted as an R15 rig. Defaults to `true`.

### ImportFbxRig

```luau
Plugin:ImportFbxRig(isR15: boolean? = true): Instance
```

- Tags: Deprecated, Yields, Plugin security
- Use instead: [`Plugin.ImportFbxRigAsync`](https://rapi.sleaze.dev/classes/Plugin.md)

**Deprecated:** This method has been superseded by [`ImportFbxRigAsync()`](https://rapi.sleaze.dev/classes/Plugin.md).

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`](https://rapi.sleaze.dev/classes/Workspace.md).

Parameters:

- `isR15`: Whether the rig file should be interpreted as R15. Defaults to `true`.

### OpenScript

```luau
Plugin:OpenScript(script: LuaSourceContainer, lineNumber: number? = 1)
```

- Tags: Deprecated, Plugin security

**Deprecated:**

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.

Parameters:

- `script`: The [`LuaSourceContainer`](https://rapi.sleaze.dev/classes/LuaSourceContainer.md) script instance to open.
- `lineNumber`: The line number to navigate to in the editor. Defaults to `1`.

### PromptSaveSelection

```luau
Plugin:PromptSaveSelection(suggestedFileName: string? = ""): boolean
```

- Tags: Deprecated, Yields, Plugin security
- Use instead: [`Plugin.PromptSaveSelectionAsync`](https://rapi.sleaze.dev/classes/Plugin.md)

**Deprecated:** This method has been superseded by [`PromptSaveSelectionAsync()`](https://rapi.sleaze.dev/classes/Plugin.md).

Prompts the user to save their current selection with the specified file name.

Parameters:

- `suggestedFileName`: The default file name shown in the save dialog. Defaults to an empty string.

## Events

### Deactivation

```luau
Plugin.Deactivation: RBXScriptSignal<()>
```

- Tags: Plugin security

Fired when the plugin is deactivated.

### Ready

```luau
Plugin.Ready: RBXScriptSignal<()>
```

- Tags: Roblox script security

### Unloading

```luau
Plugin.Unloading: RBXScriptSignal<()>
```

- Tags: Plugin security

Fires immediately before the [`Plugin`](https://rapi.sleaze.dev/classes/Plugin.md) stops running.

### ViewportDragDropped

```luau
Plugin.ViewportDragDropped: RBXScriptSignal<(dragData: { [string]: any })>
```

- Tags: Roblox script security

### ViewportDragEntered

```luau
Plugin.ViewportDragEntered: RBXScriptSignal<(dragData: { [string]: any })>
```

- Tags: Roblox script security

### ViewportDragLeft

```luau
Plugin.ViewportDragLeft: RBXScriptSignal<()>
```

- Tags: Roblox script security

## Callbacks

### ProcessAssetInsertionDrag

```luau
Plugin.ProcessAssetInsertionDrag: (assetId: string, assetTypeId: number, instances: { Instance }) -> { Instance }
```

- Tags: No yield, Roblox script security

### ProcessAssetInsertionDrop

```luau
Plugin.ProcessAssetInsertionDrop: () -> ()
```

- Tags: No yield, Roblox script security

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
