guiGetVisible | Multi Theft Auto: Wiki Skip to content

guiGetVisible

Client-side
Server-side
Shared

Pair: guiSetVisible

This function determines if a GUI element is visible.

OOP Syntax Help! I don't understand this!

  • Method:gui-element:getVisible(...)
  • Variable: .visible

Syntax

bool guiGetVisible ( ​gui-element guiElement )
Required arguments
  • guiElement: The GUI element to be checked.

Returns

Returns true if the element is visible, false otherwise.

  • bool: result

Code Examples

client

This example toggles the visibility of window.

local myWindow = guiCreateWindow(0, 0, .5, .5, "my window", true) -- Create the gui window
function guiToggleVisible()
if (guiGetVisible(myWindow)) then -- check if the gui element is visible
guiSetVisible(myWindow, false) -- if it is, we hide it
else
guiSetVisible(myWindow, true) -- if not, we make it visible
end
end
bindKey("space", "down", guiToggleVisible) -- bind the player's spacebar to the function guiToggleVisible

See Also

GUI Functions