Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a GUI that opens and closes on click?

Asked by 7 years ago

How do you make a GUI that opens when you click another GUI and closer when you click something else, like an 'X'?

1
Look into the MouseButton1Click event. We will not make a script for you. M39a9am3R 3210 — 7y
0
Okay, thanks. GraserBLOX 0 — 7y
0
I also recommend that you watch AlvinBlox's scripting tutorials. They're very helpful . FearlessAfrican 34 — 7y
0
I Will Make You a little somthing as a Hand For your Problem LearnBeginnersLua -2 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
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:

Ad

Answer this question