I had trouble making a open and close script for local plugins for the Toolbar so after I finally figured it out I’m just sharing it here.
You can obviously Customize the name and info of the Toolbar Plugin on Line 2, Example:
local toolbar = plugin:CreateToolbar("(Plugin Description")
local button = toolbar:CreateButton("(Name)", "(Hover Description)", "(RBXAsset Link")
This is the setup it should be in:
local toolbar = plugin:CreateToolbar("My Custom Tools")
local button = toolbar:CreateButton("Toggle GUI", "Click to toggle the GUI in CoreGui", "")
local guiCloned = false
local clonedGui
button.Click:Connect(function()
if not guiCloned then
-- Clone the GUI into CoreGui
local gui = script.Parent:FindFirstChildOfClass("ScreenGui")
if gui then
clonedGui = gui:Clone()
clonedGui.Parent = game:GetService("CoreGui")
guiCloned = true
else
warn("No GUI found to clone.")
end
else
-- Remove the cloned GUI from CoreGui
if clonedGui then
clonedGui:Destroy()
guiCloned = false
end
end
end)