How do you make a GUI that opens when you click another GUI and closer when you click something else, like an 'X'?
COMMUNITY QUESTION
How do you make a GUI that opens and closes on click?
1 answer
local Plr=game.Players.LocalPlayer
local IsOpen=true
-- Gui --
Root=Instance.new("ScreenGui",Plr.PlayerGui)
MainFrame=Instance.new("TextLabel",Root)
MainFrame.BackgroundTransparency=.7
MainFrame.Position=UDim2.new(0,0,.3,0)
MainFrame.Size=UDim2.new(.2,0,.3,0)
MainFrame.Text=""
MainFrame.BackgroundColor3=Color3.fromRGB(0,0,0)
SoundBox=Instance.new("TextBox",MainFrame)
SoundBox.TextColor3=Color3.fromRGB(255,255,255)
SoundBox.Text="Text To Print"
SoundBox.Size=UDim2.new(.8,0,.1,0)
SoundBox.Position=UDim2.new(.1,0,.05,0)
SoundBox.BackgroundTransparency=.7
SoundBox.BackgroundColor3=Color3.fromRGB(112,112,112)
Load=Instance.new("TextButton",MainFrame)
Load.BackgroundColor3=Color3.fromRGB(112,112,112)
Load.BackgroundTransparency=.7
Load.Position=UDim2.new(.2,0,.2,0)
Load.Size=UDim2.new(.2,0,.1,0)
Load.TextColor3=Color3.fromRGB(255,255,255)
Load.Text="Print"
Open=Instance.new("TextButton",MainFrame)
Open.BackgroundColor3=Color3.fromRGB(112,112,112)
Open.BackgroundTransparency=.5
Open.Position=UDim2.new(1,0,0,0)
Open.Size=UDim2.new(.05,0,1,0)
Open.Text="<"
Open.TextWrapped=true
Open.TextColor3=Color3.fromRGB(27,42,53)
local OpenF = function()
if IsOpen then
IsOpen=false
MainFrame:TweenPosition(UDim2.new(-.2,0,.3,0), "InOut", "Quad", 3)
Open.Text=">"
else
IsOpen=true
MainFrame:TweenPosition(UDim2.new(0,0,.3,0), "InOut", "Quad", 3)
Open.Text="<"
end
end
local LoadM = function()
print(..SoundBox.Text)
end
Load.MouseButton1Click:connect(LoadM)
Open.MouseButton1Click:connect(OpenF)
here you go c:
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
Look into the MouseButton1Click event. We will not make a script for you.
Okay, thanks.
I also recommend that you watch AlvinBlox's scripting tutorials. They're very helpful .
I Will Make You a little somthing as a Hand For your Problem