guiSetVisible | Multi Theft Auto: Wiki Skip to content

guiSetVisible

Client-side
Server-side
Shared

Pair: guiGetVisible

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function changes the visibility state of a GUI element.

OOP Syntax Help! I don't understand this!

  • Method: guielement:setVisible(...)
  • Variable: .visible

Syntax

bool guiSetVisible ( element guiElement, bool state )
Required Arguments
  • guiElement: the GUI element whose visibility is to be changed
  • state: the new visibility state

Returns

  • bool: value

Returns true if the element's visibility could be changed, false otherwise.

Code Examples

shared

This example creates a GUI window and changes its visibility every 2 seconds, indefinitely.

-- Create a GUI window called 'myWindow'
myWindow = guiCreateWindow( 0.3, 0.3, 0.5, 0.60, "GUI window title", true )
-- Set a timer to change the window's visibility every 2 seconds, indefinitely
setTimer( function( )
-- We toggle the visibility here by taking the opposite result of guiGetVisible (false => true, true => false), hence toggling its visibility
guiSetVisible( myWindow, not guiGetVisible( myWindow ) )
end, 2000, 0 )

See Also

GUI Functions