How to make a GUI disappear when a button is clicked

Do you just need the GUI transparent or destroyed/deleted?

image

HWYYYY NOOWW!!!

thats default name that they make it to when you make a frame and it says that “frames” so i recommended to name these frame name to different and put the frames name to the frame name that you name it to. so it works. just like.

Frame.Visible = false

Wrong. :x: Now onto another script:

Frame.Visible = false
Frame.Visible = true

Wrong again. :x: Onto another script.

YourFrameName(notsupposedtobesame).Visible = false
YourFrameName(notsupposedtobesame).Visible = true

Correct. right. :white_check_mark:

1 Like

But why u talking about frames? My script is disable the screen UI?

1 Like

to disable your Gui screen right.

this is what you mean?

You should get PlayerGui instead of StarterGui. Everything inside StarterGui clones into player’s PlayerGui when player joins to the game and player is seeing PlayerGui, not StarterGui.

Yes that is what I was thinking

1 Like

use visible but u just do if the script is in the button

local frame = script.Parent.Parent:WaitForChild("Frame")
2 Likes

Okay. before i edit script again. im gonna get some info so i can make sure if it works. Do you have 1 frames or screen gui being visible and another 1 frames or screengui being not visible?

Also do that what they said. @LifeDigger

image

1 Like

OMG I am soooo confused lol. :frowning:

Can you show your script again?

What do u want me to show u?? I have changed it soo much from my old script and nothing works. All I have been given is confusion

That’s why i asked. Can you show it so i can see what you’re doing wrong if you’re doing something wrong.

To be honest I have no clue anymore

local frame = script.Parent.Parent:WaitForChild("Frame")

local wow = script.Parent

wow.MouseButton1Click:Connect(function()

frame.Visible = false

end)

I don’t think you need a :WaitForChild() for that. Is it not detecting the click? Try adding prints inside the .MouseButton1Click event to see if it fires. If it still jot detecting the click maybe something covering the button.

Put this in a LocalScript (NOT A Script) inside the button:

local button = script.Parent
local StartUI = button.Parent
local frame = StartUI:WaitForChild("Frame")
button.MouseButton1Click:Connect(function()
     frame.Visible = false
end)
1 Like

This is simple, just create your screen gui. Put a frame inside, name it what you like. Then put your text button in, then add a script the screen gui and it should look something like this.

Local Frame = script.Parent.Frame -- put the name of your frame
Local Button = script.Parent.TextButton -- Put the name of your text button

Button.MouseButton1Click:Connect(function()
Frame.Visible = false
end)

Try this. Not assigning a variable for the button as there is zero point. Follow this word by word.

local player = game:GetService("Players")
local frame = player.LocalPlayer.PlayerGui.["Start UI"].Frame

script.Parent.MouseButton1Click:Connect(function()
frame.Visible = false
end)
14 Likes