Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

0

If it's in a localscript, it won't work.

2 answers

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

4 comments

0

I am confused by ButtonFrame. I can't find buttonframe.

0

When you click on StarterGui and you click Add and click ScreenGui You click add on the screenGui then you type TextBox

0

I mean TextButton

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

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).

2 comments

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.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.