Deactivate Plugin ToolbarButton

I’m trying to deactivate the plugin button on the toolbar inside the plugin script.
imageimage
I’m not looking to disable the button, but to simply deactivate it as if you were to click it.
image

I’ve been looking on the devforum and documentation for too much, so I decided to ask here. I know it’s possible because I’ve seen other plugins do it.

I’ve tried .SetActive(), .Activate and .Enabled

Current situation:

if not pluginGui.Enabled and ran then launch:SetActive(false) end

Any help is appreciated!

Try this:

function DisableButton() 
launch:SetActive(false)
yourwidget.Enabled = false
end)

function EnableButton()
launch:SetActive(true)
end)

yourwidget:BindToClose(DisableButton)

launch.Click:connect(EnableButton)
2 Likes

It worked after I added :SetActive(true) and then :SetActive(false) after.
Thanks!

2 Likes