How can I make a UI button to open and close up another UI?

How can I make a UI button to open up another UI?

user presses ui button *another ui shows up.

3 Likes

ui has to be a text button or image button to open up anything

1 Like

Make a button on the first GUI that has a local script under it and using the script type

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

Script.Parent.MouseButton1Click:Connect(Function() -- When you press the first GUI button do this function
LocalPlayer.PlayerGui.OTHER GUI.Enabled = true -- sets the second GUI to be visble
End)

Ps if you want to make it have cool animations and make it look more professional then take a peak at this

For example

script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0), 'Out', 'Bounce', 1.5)
-- This will make the frame go to this position 0,0,0,0 in 1.5 seconds)
end

Using the above line of code you can put it in the first function and you have added animations.

8 Likes

Would you happen to know how to make it have a slide animation when it opens?

1 Like

There is a EDIT button you can use instead of deleting the post

2 Likes

Do I put the tween script in the bui i want animated?

1 Like

You would put this line of code

script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0), 'Out', 'Bounce', 1.5)

In the original function.
Like I said above this will make where ever the current GUI is move to the position you set In this example 0,0,0,0
Heres what this does on my GUI
https://i.gyazo.com/ce031b997c6a958cc01dbc86f11fa13f.mp4

4 Likes