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

How Do I Make A Closing Screen Gui Script?

I'm Making A Game, And I Made A Menu GUI. I Added An X Button, And I Don't Know The Script To Close It. Little Help Please..? This Is The Script I Tried From Some Other Post, But It Doesn't Work.

button = script.Parent
2	function onClicked()
3	if button.MouseButton1Click
4	then button.Visibile = false -- this only removes the button how do i get it to remove everything else
5	    end
6	end
7	button.MouseButton1Click:connect(onClicked)

What Is The Script I Should Use??

9 comments

0

;-;

0

just tell the gui to delete from player gui after the x is pressed :/

0

just tell the gui to delete from player gui after the x is pressed :/

0

And... How Do I Do That?

0

How..

0

either do this: (whatever the fullname of the screengui is):Delete() after x is clicked. or tell it to move somewhere else like make it a member of lighting (lighting is a good landfill for things like models or guis that you want to load in at certain times)

0

:Destroy()

1

maybe because you spelt visible wrong

0

^ Lmao.

3 answers

button = script.Parent
   function onClicked()
   if button.MouseButton1Click
   then button.Visibile = false

script.Parent:Remove()

 end
 button.MouseButton1Click:connect(onClicked)

3 comments

0

you also need to remove screen

0

maybe because visible is spelt wrong

0

script.Parent is the button not the GUI. You will need to delete the GUI, I assume it could be script.Parent.Parent:Destroy()

epic not fail

button = script.Parent
   function onClicked()
   if button.MouseButton1Click
   then button:Remove()
else
       end
   end

   button.MouseButton1Click:connect(onClicked)

no local script

I would prefer the store the Menu GUI and the x button under the same Screen GUI as Screen GUIs have a property, Enabled. So you can disable it on a click of a button.

button = script.Parent
notclicked = true

function OnClicked()

		script.Parent.Parent.Enabled = false
	end

script.Parent.MouseButton1Down:Connect(function(OnClicked)

Both the Menu GUI and Button is nested under a Screen Gui.

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