Plugin GUI Won't close when gui unselected

m Making A Plugin For Y’all To Use But I Ran Into A Problem… When the gui is on and i click the plugin button it doesn’t close the gui? :thinking: How Can I Solve This ?
Feel free to reply !
here is the script:

local toolbar = plugin:CreateToolbar("Rig Build v1")
local button = toolbar:CreateButton("Rig Build v1", "Build A Rig Easily", "rbxassetid://17117819876")

button.Click:Connect(function()
	local gui = script:WaitForChild("MainGui")
	if gui.Parent == script then
	gui.Parent = game:WaitForChild("CoreGui")
	elseif gui.Parent == game:WaitForChild("CoreGui") then
		gui.Parent = script
	end
end)

script.MainGui.Main:WaitForChild("R15"):WaitForChild("Button").MouseButton1Click:Connect(function()
	local rig = script:WaitForChild("R15")
	local clone = rig:Clone()
	clone.Parent = workspace
	clone.Name = "Rig"
	print("R15 Rig Has Been Inserted.")
end)

script.MainGui.Main:WaitForChild("R6"):WaitForChild("Button").MouseButton1Click:Connect(function()
	local rig = script:WaitForChild("R15")
	local clone = rig:Clone()
	clone.Parent = workspace
	clone.Name = "Rig"
	print("R6 Rig Has Been Inserted.")
end)
1 Like

Use property yourGUI.Visible = false or destroy your GUI when click yourGUI:Destroy()

Put it into the button script

i don’t think it would work because it’s a plugin

I don’t see any options which close your GUI. I think you can try it out

gui:Destroy() wont work, cuz it will delete the gui completely

You can put your GUI in the Replicated storage, :Clone() it and then feel free to destroy

lemme try
11111111111111111111

didn’t work
1111111111111111111111111

i have fixed it, basically what i did is “local gui = script:WaitForChild(“MainGui”)” inside the variable of button.Click

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