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

I need help with a script that opens a gui when you click a button in a gui, help? [closed]

Asked by 6 years ago

I have this gui here with an options button, I want to be able to click the options button and it opens another gui, can anyone help me with this?

0
wheres ur script User#23365 30 — 6y

Closed as Not Constructive by User#21908 and User#23365

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
-1
Answered by 6 years ago
01local gui= script.Parent.Parent:FindFirstChild("gui")
02local options= script.Parent
03 
04local open = false
05 
06options.MouseButton1Down:connect(function()
07    if open == false then
08        wait(0.5)
09        menu:TweenPosition(UDim2.new(0.25,0,0.2,0), "Out", "Quad", 1)
10        open = true
11    else
12        wait(0.5)
13        menu:TweenPosition(UDim2.new(-1,0,0.2,0), "Out", "Quad", 1)
14        open = false
15    end
16end)

That should do it. Of course you will need to edit it to your preference.

0
:connect() is deprecated, use :Connect() User#23365 30 — 6y
Ad
Log in to vote
1
Answered by
SCP774 191
6 years ago

Here's the general idea of how to open a GUI using a GUI button.

1local BUTTON = {PATH TO THE GUI BUTTON HERE}
2local GUIToOpen = {PATH TO THE DESIRED GUI TO OPEN HERE}
3 
4BUTTON.MouseButton1Down:Connect(function()
5    GUIToOpen.Visible = true
6end)

You can modify the script in any way to make it toggleable, have more functions etc. You can make many things with this script, just explore more with it. :)