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

My script to make a GUI invisible is needs a 'function call'?

Asked by 4 years ago
Edited 4 years ago

I am trying to use this script to make a GUI invisible. It says it expected an assignment or function call.

GUI = game.StarterGui.Frame
button = script.Parent
if button.MouseButton1Click
then 
    GUI.Visible false
end

Just to be clear I want to change .visible to false.

Edit: The screengui is in a frame, I was told to do that

0
If it's in a localscript, it won't work. User#29320 0 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
gui = game.StarterGui.Frame
button = script.Parent
if button.MouseButton1Click
then 
    gui.Visible = false
end

You should keep gui lowercased and when your determining visible you put = after visible so it knows you want to change the visibility respond if a problem. Also make sure your using a ButtonFrameinstead of regular frame

0
I am confused by ButtonFrame. I can't find buttonframe. ImASquirrelYipee 15 — 4y
0
When you click on StarterGui and you click Add and click ScreenGui You click add on the screenGui then you type TextBox DuckyRobIox 280 — 4y
0
I mean TextButton DuckyRobIox 280 — 4y
0
I had to go but just got back. I tried your code, then put everything into a text button and tried again. Nether worked, I am sorry but I am new ImASquirrelYipee 15 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
script.Parent.MouseButton1Click:Connect(function()
    game.StarterGui.TextButton.Visible = false
end)

You'll need to replace the Frame you're using with a TextButton. You also could define those variables, but you don't need to because you only use them once. Also, you don't have any :WaitForChild statements.

Just to let you know MouseButton1Click is a event and not a boolean, meaning you'll need to connect it to the function (what the error was saying).

0
This is meant to be put inside a textbutton, inside screengui, inside another textbutton inside startergui, correct? For some strange reason nothing seems to work the only other thing I have inside screengui is a text label. ImASquirrelYipee 15 — 4y
0
ScreenGuis need to be the parent of any GUI elements, so you can't have a screengui parented to a textbutton. Both textbuttons must be parented to a screengui to be visible. Crystalflxme 104 — 4y

Answer this question