Need Help With Closing A Plugin UI

I’m Trying To Make A Plugin And Add A Close Button But It Won’t Function And Giving Me This Error.

Screen Shot 2021-04-14 at 6.53.51 PM

local toolbar = plugin:CreateToolbar("Pre-Made Scripts")

local GuiButton = toolbar:CreateButton("Pre-Made Scripts", "Open Pre-Made Scripts", "rbxassetid://6681913137")

local function GuiButtonClicked()
	
	local UI = script.Select
	
	if UI == false  then
		
		game.CoreGui.Select.Enabled = true
		
	else

		UI.Parent = game:GetService("CoreGui")
		UI.Enabled = true
	end

end
GuiButton.Click:Connect(GuiButtonClicked)
1 Like

Dk much about plugins but It looks like the script inside cannot find the Select object, are you sure you implemented it there and not somewhere else?

Yes After I Click The Plugin And Try To Unselect And It Gives Me The Error

Maybe this could be why? Since you’re parenting the UI back to the CoreGui it’s unable to find it again when calling your UI variable

Fixed It I Forgot Todo :Clone()

Oh okay Does the script work now?

1 Like