Skip to content

onPlayerPressLeftClick

KabanFriends edited this page Nov 27, 2022 · 1 revision

function: onPlayerPressLeftClick(event)

A function that is called when a player presses the left mouse button.
The event object contains following fields:

player : Player

  • The Player that triggered this event.

yaw : number

  • Yaw value of the player when this event was triggered.

pitch : number

  • Pitch value of the player when this event was triggered.

entityId : number

  • ID of the entity that the player was looking at when this event was triggered.
  • Returns nil if there is no entity involved with the event.

x : number

  • X coordinate of the block that the player clicked.
  • Returns nil if the player was not looking at any block.

y : number

  • Y coordinate of the block that the player clicked.
  • Returns nil if the player was not looking at any block.

z : number

  • Z coordinate of the block that the player clicked.
  • Returns nil if the player was not looking at any block.

face : string

  • Face of the block that the player clicked. Returns nil if the player was not looking at any block.
  • If there is a block involved with the event, the return value is one of the following:
    • towardsX
    • towardsY
    • towardsZ
    • awayX
    • awayY
    • awayZ