So I created a script that if you click a plugin button on the toolbar it opens a gui that is the main plugin scripts child. And when I test it does not work. Here is the script:
local toolbar = plugin:CreateToolbar("Essentials")
local newScriptButton = toolbar:CreateButton("Launch Essentials", "Essentials -V0.0.1B", "rbxassetid://12375039577")
newScriptButton.Click:Connect(function()
script:WaitForChild("mainGui")
if script.mainGui.Parent == script then
script.mainGui.Parent = game:WaitForChild("CoreGui")
elseif script.mainGui.Parent == game:WaitForChild("CoreGui") then
script.mainGui.Parent = script
end
end)
If you can please help me.