Roblox UtilitiesDevlHub Roblox Documentation

Class

PluginToolbarButton

NotCreatable
Inherits
Instance › Object
Memory category
Instances

A button on a PluginToolbar in the Studio ribbon, created by PluginToolbar:CreateButton(), that fires Click when pressed.

A PluginToolbarButton object is created through the PluginToolbar:CreateButton() function. It allows the user to initiate a single, one-off action in Roblox Studio through the Click event. Toolbar buttons can also be assigned a keyboard shortcut through Studio's File ⟩ Customize Shortcuts window.

When pressed, the Click event fires. A button will also remain in the pressed state, which may be set manually using SetActive(). Upon plugin activation (Plugin:Activate()), buttons in all other PluginToolbars will be toggled off. If all buttons in a toolbar are off, the toolbar's plugin is deactivated (Plugin:Deactivate()).

When the game viewport is not visible, buttons will be disabled as if their Enabled property were false. Disabled buttons are desaturated and do not respond to user clicks. By setting ClickableWhenViewportHidden to true, you can allow plugin buttons to remain clickable, such as during script editing.

Properties 4#

ClickableWhenViewportHiddenbooleanDetermines whether the button can be clicked when the 3D viewport is hidden, such as when a Script is being edited in another tab.ReadSafeNotReplicated
EnabledbooleanDetermines whether the button is clickable in general.ReadSafeNotReplicated
IconContentIdDetermines what icon should represent the button.ReadSafeNotReplicated
IconContentContentThe content of the image used as the button's icon in the toolbar. Only supports asset URIs.Read: PluginSecurityWrite: PluginSecurityReadSafeNotReplicated

ClickableWhenViewportHidden: boolean#

NotReplicatedReadSafe

This property determines whether a PluginToolbarButton may be clicked while the 3D viewport is hidden, such as when a Script is being edited in another tab.

Typically, this property should be enabled if an action triggered by a plugin button's Click event doesn't occur in the 3D world (Workspace). For example, a button that opens a widget should have this property as true, since showing a widget is visible to the user even if the 3D view isn't visible.

Enabled: boolean#

NotReplicatedReadSafe

This property determines whether a button is clickable in general. When false, the button will be greyed out and unclickable, preventing the user from firing the Click event. Buttons are enabled by default.

When re-enabling this property, the plugin button's state won't be remembered from the previous state in which the user left the button in. Instead, it will default to the last state set by SetActive() or to the inactive state if SetActive() was never used.

Plugins should disable their buttons when the button action isn't relevant in the current context. For example, a plugin button that assigns random colors to selected should not be enabled when the selection contains no parts.

See also ClickableWhenViewportHidden which determines whether a button is clickable when the game view is hidden (and not just in general).

Icon: ContentId#

NotReplicatedReadSafe

This property determines which Content should be shown for the button's icon in the toolbar. When this property is not set, the button will instead use the button's text given by PluginToolbar:CreateButton().

IconContent: Content#

NotReplicatedRead: PluginSecurityWrite: PluginSecurityReadSafe

This property sets the image content displayed as the button's icon in the plugin toolbar. When this property is not set, the button instead displays the text label provided when calling PluginToolbar:CreateButton(). Only asset URIs are supported for this property.

Methods 1#

SetActiveSets the state of the plugin button.PluginSecurity security

SetActive(active: boolean): ()#

PluginSecurity security

This method can be used to manually set the active state of the plugin button.

When the Enabled property is toggled back on, the button will either revert to the last state set by this method or default to inactive if this method hasn't been used previously.

NameTypeDefaultDescription
activebooleanWhether to set the button to its active, pressed state (true) or its inactive state (false).
Returns
  • ()

Events 1#

ClickFires when the user presses and releases their cursor on the button.PluginSecurity security

Click()#

PluginSecurity security

This event fires when the PluginToolbarButton is pressed and released by the user.

See also SetActive() to manually set the state of the button.

Inherited members#

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

ClassName, className

Events (1)

Changed