isCursorShowing
Client-side
Server-side
Shared
This function determines the state of a player's cursor.
This function only handles the cursor state set by the showCursor function, ignoring it if the console, chatbox, or menu is opened.
If you use this function on the server-side, keep in mind that it only detects the showCursor function executed on the server-side and not changes done by client-side.
Client Syntax
bool isCursorShowing ( )
Returns
- bool: result
Returns true if the player's cursor is visible, and false if it is not.
Server Syntax
bool isCursorShowing ( player playerElement )
Required Arguments
- playerElement: The player from whom we want to retrieve the cursor state.
Returns
- bool: result
Returns true if the player's cursor is visible, and false if it is not.
Code Examples
client - Toggle Cursor
This example creates a function to set the state of the player's cursor using the showCursor function.
function toggleCursor() local cursorState = isCursorShowing() -- Retrieve the state of the player's cursor local cursorStateOpposite = not cursorState -- The logical opposite of the cursor state
showCursor(cursorStateOpposite) -- Setting the new cursor stateend