Studio Plugin Toolbar Buttons: Single pulse instead of toggle?

Hi all,

I am currently creating my first plugin, and everything is going as expected. However, I have noticed that the plugin toolbar buttons act as toggle buttons by default (click 1, dark grey, click 2, back to normal,) and I cannot find documentation for this behavior on the developer website. Given I would like to utilize and nullify this behavior for different circumstances, I was wondering if anyone has information on how to read and change this property.

Thank you!

2 Likes

You can’t change this…? This is a part of roblox studio. Please do some research first.

I don’t get why you’d want to do this?

Rather than enabling/disabling an entire plugin, using these buttons for one time use functions is a practical use of this.

I unfortunately did not see any statement in my research that revealed this. Thank you for the clarification! I do wish this was a feature.

If you make a plugin that runs a function and automatically closes itself, then that could work.

I did not think of that as a possibility. I will try this, thank you!

I actually found a really hacky way to do this. If you simply disable and re-enable a plugin toolbar button rapidly, it will reset the button state allowing you to achieve this behavior.

2 Likes

If I understand what you want correctly, you would have to use :SetActive.

https://developer.roblox.com/en-us/api-reference/function/PluginToolbarButton/SetActive

I can’t quite figure out how to use this, unfortunately.
I’ve tried the following:

local function AttachmentLocus()
	--LocusButton.Enabled = false
	--LocusButton.Enabled = true
	LocusButton:SetActive(true)

which does not throw an error, but does not change the state. I do see the documentation that suggests the use of this in the plugin toolbar button page ((PluginToolbarButton),) but again, I cannot get it to do anything.

I tried using this api, but I couldn’t get it to do anything. Though it works when I’m using it in a BindToClose function in one of my plugins.

widget:BindToClose(function()
	button:SetActive(false)
	widget.Enabled = not widget.Enabled
end)

If I understand correctly, closing a plugin will disable the button states automatically. This may be the case if the close you bind to is a plugin.