Class · inherits Instance
Plugin
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.0099999997764826for a user setting of0.01, or0.4000000059604645for a user setting of0.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
Deactivationevent.See Also
IsActivatedWithExclusiveMouse()which returnstrueif the plugin is currently active with an exclusive mouse, after having been activated via this method.Unloadingwhich fires immediately before the plugin is unloaded or reloaded via uninstallation, deactivation, or updating.
CreateDockWidgetPluginGuiAsync
(pluginGuiId: string, dockWidgetPluginGuiInfo: DockWidgetPluginGuiInfo) → DockWidgetPluginGuiYieldsPluginCreates aDockWidgetPluginGuigiven aDockWidgetPluginGuiInfo.This method creates a new
DockWidgetPluginGuifrom the givenDockWidgetPluginGuiInfo. 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 aPluginActionwhich represents a generic performable action in Studio with no directly‑associatedPluginToolbarButton.This method creates a
PluginActionwhich represents a generic performable action in Studio with no directly‑associatedPluginToolbarButton.See also
CreatePluginMenu()which creates a StudioPluginMenuthat can display a list ofPluginActions.CreatePluginMenu
(id: string, title: string, icon: string) → PluginMenuPluginCreates a new plugin menu.This function creates a new
PluginMenuwhich is a context menu that can be shown in Studio that displays a list ofPluginActionsand also supports submenus.CreateToolbar
(name: string) → PluginToolbarPluginCreates a newPluginToolbarwith the given name.This method creates a new
PluginToolbarwith 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
PluginMouseif it has been activated.See Also
Activate()which sets the state of the calling plugin to activated.Deactivationwhich fires when the plugin is deactivated.Unloadingwhich fires immediately before the plugin is unloaded or reloaded via uninstallation, deactivation, or updating.
GetJoinMode
() → JointCreationModePluginReturns theJointCreationModethe user has set in Studio's toolbar.GetMouse
() → PluginMousePluginReturns aMousethat can be used while the plugin is active.This method returns a
PluginMousethat can be used while the plugin is active throughActivate().GetSelectedRibbonTool
() → RibbonToolPluginReturns the currently selectedRibbonTool.This method returns the currently selected
RibbonTool.GetSetting
(key: string) → VariantPluginRetrieves a previously stored value with the given key, ornilif the given key doesn't exist.Retrieves a previously stored value with the given key, or
nilif 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
nilif 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.fbxanimation file that can be loaded onto therigModel, then proceeds to insert the animation as aKeyframeSequencein theWorkspace.This function prompts the user to open a
.fbxanimation file that can be loaded onto therigModel, then proceeds to insert the animation as aKeyframeSequencein theWorkspace.ImportFbxRigAsync
(isR15: boolean = true) → InstanceYieldsPluginPrompts the user to open a.fbxfile, uploads the individual components of the model as meshes, and generates a character rig for use in animation, which is loaded into theWorkspace.Intersect
(objects: Instances) → InstancePluginIntersects the given parts and returns the resultingIntersectOperation.IsActivated
() → booleanPluginReturnstrueif this plugin is currently active, after having been activated via theActivate()function.This function returns true if this plugin is currently active, after having been activated via the
Activate()function.IsActivatedWithExclusiveMouse
() → booleanPluginReturnstrueif this plugin is currently active with an exclusive mouse.This function returns
trueif this plugin is currently active with an exclusive mouse, after having been activated via theActivate()function. If this returnstrue, aPluginMousecan be retrieved viaGetMouse().See Also
Deactivationwhich fires when the plugin is deactivated.Unloadingwhich fires immediately before the plugin is unloaded or reloaded via uninstallation, deactivation, or updating.
Negate
(objects: Instances) → InstancesPluginNegates the given parts and returns the resultingNegateOperations.OpenWikiPage
(url: string) → ()PluginOpens the context help window to the wiki page thaturllinks to.PromptForExistingAssetId
(assetType: string) → int64YieldsPluginOpens a window in Roblox Studio that prompts the user to select an existingAssetType.Animationasset. TheassetTypeparameter must beAnimation; 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
Animationas theassetTypeargument.Returns the selected animation asset ID as an
int64, or-1if the user closes the dialog without selecting an asset. IfassetTypeis notAnimation, this method errors.PromptForExistingAssetIdAsync
(assetType: string) → int64YieldsPluginOpens a window in Roblox Studio that prompts the user to select an existingAssetType.Animationasset. TheassetTypeparameter must beAnimation; 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
Animationas theassetTypeargument.Returns the selected animation asset ID as an
int64, or-1if the user closes the dialog without selecting an asset. IfassetTypeis notAnimation, 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
trueif 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
positionproperty will not affect the dialog popups.Separate
(objects: Instances) → InstancesPluginSeparates the givenUnionOperationsand 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
.jsonformat as a map with string keys. Arrays are automatically converted to maps by converting the numeric keys to strings first.Note that the
.jsonformat 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().- Backslashes (
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, andPluginGui.PluginDragLeft.Union
(objects: Instances) → InstancePluginUnions the given parts and returns the resultingUnionOperation.
Events 2
Deactivation
Plugin.Deactivation:Connect(function())PluginFired when the plugin is deactivated.Fired when the
Pluginis deactivated. This occurs when either the plugin code callsDeactivate(), or because some other plugin calledActivate(), which forces all other plugins to lose their active state.See also
Unloadingwhich fires immediately before the plugin is unloaded or reloaded via uninstallation, deactivation, or updating.Unloading
Plugin.Unloading:Connect(function())PluginFires immediately before thePluginstops running.This event fires immediately before the
Pluginstops 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, andPluginGuisare 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.