Trouble putting 2 buttons in the same toolbar with different scripts (plugins)

so i want to make multiple plugins that share the same toolbar but with the ability of being individually installed, so far this is whats happening
image
but i want it to look something like this (i understand how they do it with a single script but i was wondering if its possible with more than one script)
image
are there any ways i could do this without one centralized script?

I suppose you could do it if you can find a way to transfer the plugin toolbar from one script to another, then create the button in the toolbar.
I haven’t dealt with plugins much, so I’m unsure if you actually can, but if you can send data from one plugin script to another (e.g. through bindable events) you should be able to send the toolbar.

(If that doesn’t make sense lmk, and I can try rewriting it)


edit:

I was able to test my theory successfully, using the 2 scripts which were uploaded as seperate plugins:

local TB = plugin:CreateToolbar("Testing")
_G.PLUGINTOOLBAR = TB
TB:CreateButton("A", "A", "")
while not _G.PLUGINTOOLBAR do
	task.wait(0.25)
end
_G.PLUGINTOOLBAR:CreateButton("B", "B", "")

image
Seems to work

1 Like

These are all created by the same plugin. A better example would be the Elttob Suite and the GeomTools.

Both of these share the Product Hub button, and then each plugin has their own button. Making a shared toolbar system is very tricky, so don’t be surprised if it takes a few weeks, or more. This one has been curated for years, and it still has bugs.

:cry: I don’t think this can be fixed.

Would there be another way of doing this without fully depending on one script creating the toolbar, (like only having the B plugin and not having the A plugin while still having the Testing toolbar)

I tried doing something like this

local pluginToolbar = (_G.DEVELOPMENT_TOOLS or plugin:CreateToolbar("Development Tools"))
_G.DEVELOPMENT_TOOLS = pluginToolbar

but it just responds with
Cannot create a toolbar button at this time.

I guess you could have the code from A in all of them, but check that it doesn’t already exist.

if not _G.PLUGINTOOLBAR then
	_G.PLUGINTOOLBAR =  plugin:CreateToolbar("Testing")
end
-- rest of the code

Toolbar or toolbar button?

You may need to add a slight delay to some of the scripts (so the first script has 0 delay, the second has 0.1, third has 0.2 and so on, so it doesn’t try to create multiple at the same instant.

this works, thank you very much
image

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.