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

Gui wont go away?

function OnClicked() 
    script.Parent.Parent.Visible = false 
end 
script.Parent.MouseButton1Down:connect() 

I cant get it to go away :C

2 comments

0

Are you trying to make a ScreenGui invisible? If so use :Destroy() instead of .Visible = false.

0

Are you setting the gui in starter gui to visible or playergui?

2 answers

✓ Accepted answer

You have not connected the event to the function so to do this it can be achieved 1 of 2 ways. first you could use an anonymous function which would look something like this

script.Parent.MouseButton1Down:connect(function()
	script.Parent.Parent.Visible = false
end)

or you could do it the way that you are trying to accomplish which would look like this

function onClick()
	script.Parent.Parent.Visible = false
end

script.Parent.MouseButton1Down:connect(onClick)

if this doesnt work then check to make sure that you are referencing the correct things because that could be the issue and i hope that this helped

buttonNameHere.MouseButton1Down:connect(function()
NameOFGuiToMakeInvisible.Visible = false
end)

That should work

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