I just made a GUI that opens and closes when i click the "OpenAndClose" TextButton. But its not working and i don't know why. The GUI doesn't appears on my screen. Also the local script parent is Workspace.
local ScreenGui = Instance.new("ScreenGui")
local MAINGUI = Instance.new("Frame",ScreenGui)
local OpenAndClose = Instance.new("TextButton",ScreenGui)
local Button1 = Instance.new("TextButton",MAINGUI)
local Button2 = Instance.new("TextButton",MAINGUI)
--MainGUI
MAINGUI.Position = UDim2.new({0.549, 0},{0.129, 0})
MAINGUI.Size = UDim2.new({0, 390},{0, 393})
MAINGUI.Visible = false
--Buttons
Button1.Position = UDim2.new({0.563, 0},{0.165, 0})
Button1.Size = UDim2.new({0, 200},{0, 50})
Button1.Text = "BRICK MATERIAL CHANGE TO NEON"
Button2.Position = UDim2.new({0.563, 0},{0.268, 0})
Button2.Size = UDim2.new({0, 200},{0, 50})
Button2.Text = "BRICK COLOR CHANGE"
--OpenAndCloseGuiSetUP
OpenAndClose.Position = UDim2.new({0.014, 0},{0.041, 0})
OpenAndClose.TextSize = 20
OpenAndClose.Text = "Open/Close Gui"
Open = false
OpenAndClose.MouseButton1Down:connect(function(open)
if Open == false then
MAINGUI.Visible = true
Open = true
elseif Open == true then
MAINGUI.Visible = false
end

9 comments
ScreenGui Parent set to StarterGui and still doesn't works?
@GodlyEricGamer1800 All you have to do is parent this script to startergui. The script is then parent ScreenGui to PlayerGui since when the player loads this script will be cloned to PlayerGui
Yeah i see, it cloned to PlayerGUI, it worked, but the properties hasn't changed
Size is set to 0, position set to 0
@GodlyEricGamer1800 What properties
OH one sec.
Ok
@GodlyEricGamer1800 Edited answer
Ok, working thank you