I am looking to be able to use one toolbar to host two of my plugins which are separate marketplace plugins. A good example of this is Stravant’s plugins which share the same toolbar, which can be seen below. How can I reference an existing toolbar from plugin to plugin?
The problem is that when I create a toolbar with the same name it will create two separate toolbars instead of one.
Below is the code I used for making the toolbars and button. I have tried to search everywhere for a solution but can’t find any. I thought of referencing the toolbar but can’t wrap my head around how.
local toolbar = plugin:CreateToolbar("Text Tools")
local button = toolbar:CreateButton("SignsPro", "Hide/show the Signs Widget.", "", "Signs")
local widget = plugin:CreateDockWidgetPluginGui("Signs", widgetInfo)
widget.Title = "Signs"
widget.Name = "Signs"
-- Pretend this is another plugin script.
local toolbar = plugin:CreateToolbar("Text Tools")
local button = toolbar:CreateButton("SignsFree", "Hide/show the Signs Widget.", "", "Signs Free")
local widget = plugin:CreateDockWidgetPluginGui("Signs", widgetInfo)
widget.Title = "Signs"
widget.Name = "Signs"
– Pretend this is another plugin script.
toolbar = plugin:FindFirstChild(“Text Tools”)
if toolbar then
local button = toolbar:CreateButton(“SignsFree”, “Hide/show the Signs Widget.”, “”, “Signs Free”)
else
plugin:CreateToolbar(“Text Tools”)
end