PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Visible

GuiObject

bool

This property determines whether a GuiObject|GUI will render shapes, images and/or text on screen. If set to false, the GUI and all of its descedants (children) will not render.

The rendering of individual components of a GUI can be controlled individually through transparency properties such as GuiObject/BackgroundTransparency, TextLabel/TextTransparency and ImageLabel/ImageTransparency.

When this property is true, the GUI will be ignored by UIGridStyleLayout objects (such as UIGridLayout, UIListLayout and UITableLayout). In other words, the space that the element would otherwise occupy in the layout is used by other elements instead.


Code Samples


UI Window

This code sample adds open/close functionality to a Window UI. Paste as a LocalScript that is a sibling of a Frame named Window, a TextButton/ImageButton named Window, and a TextButton/ImageButton within the Window called Close.

local gui = script.Parent
local window = gui:WaitForChild("Window")
local toggleButton = gui:WaitForChild("ToggleWindow")
local closeButton = window:WaitForChild("Close")

local function toggleWindowVisbility()
	-- Flip a boolean using the `not` keyword
	window.Visible = not window.Visible
end

toggleButton.Activated:Connect(toggleWindowVisbility)
closeButton.Activated:Connect(toggleWindowVisbility)

Blink UI Element

This code sample blinks a UI element on/off, much like HTML’s beloved tag. They still have that, right?

local guiObject = script.Parent

while true do
	guiObject.Visible = true
	wait(1)
	guiObject.Visible = false
	wait(1)
end