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

How do I remove a GUI from the screen?

Asked by 5 years ago
Edited 5 years ago
script.Parent.Position = UDim2.new(0.72,-25,0.20,-25)

I am trying to make it's position off the screen but it seems that it's position does not change at all. If there is a better way to remove a GUI from the screen I would love to know it.

0
this is just 25 pixels up and to the left from the scale position of 0.72, 0.20 so it's not going to be offscreen (this is about where it'll be: http://prntscr.com/ld9l1x) User#22604 1 — 5y

2 answers

Log in to vote
2
Answered by
OfcPedroo 396 Moderation Voter
5 years ago
Edited 5 years ago

If you want to make the GUI's visibility disappear:

script.Parent.Visible = false

If you want to delete the GUI:

script.Parent:Destroy()

If you want to make a smooth disappear of the GUI to that location:

script.Parent:TweenPosition(UDim2.new(0.72,-25,0.20,-25), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 0.5)

Three critical things for you to take note

The affected element (script.Parent) should be a Frame, if you made it be the actual GUI instance, change it to the Frame that controls everything and that you want to disappear;

On the last solution, Enum.EasingDirection.In equals the animation direction, Enum.EasingStyle.Quad means the animation style and 0.5 means that the animation would take 0.5 seconds to take. You can change any of those values. Learn more about Gui Tweening here and here

Also on the last solution, you could use "In" instead of Enum.EasingDirection.In and "Quad" instead of Enum.EasingStyle.Quad, but you should always use Enums when there's a chance of, for easier understand and options display, and therefor it's recommended for you to use them.

0
pretty sure it's "Visible" not "Visibility" User#22604 1 — 5y
0
also 0.72,-25,0.20,-25 isn't offscreen User#22604 1 — 5y
0
The coords were defined by the one that asked, I simply copied and pasted the coords he wanted. About the Visible thing, yeah, I made a mistake, I wasn't on ROBLOX Studio. Thanks, just fixed it. OfcPedroo 396 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

This would probably be the easiest and your best bet.

script.Parent.Visible = false

If you want to remove the whole thing,

script.Parent.Parent:remove()

You would insert this script into the TextLabel, TextButton or TextBox.

0
:remove() or :Remove() is deprecated, use :Destroy() instead User#23365 30 — 5y

Answer this question