Skip to main content

HudItem

Provides properties and functions to interact with a HudItem. Common properties that all HudItems use.

Properties

id

The ID of the hud element. This property is read-only.

localClientId

The client ID of this player. This property is read-only.

name

The name of the item.

isVisible

Controls visibility of the item for each specific player.

sortOrder

Sort order. Items with larger values will appear on top of ones with smaller values.

sizeToText

If the HudItem should adjust its size to match its text. Only applies to HudTextbox, HudButton and HudTimer.

onMouseDown

Assigns a function that will be called when a player presses a button on their mouse with the pointer over a HUD item. This property is write-only.

onMouseUp

Assigns a function that will be called when a player releases a button on their mouse with the pointer over a HUD item. This property is write-only.

onMouseClick

Assigns a function that will be called when HUD item is clicked. This property is write-only.

onMouseEnter

Assigns a function that will be called when mouse pointer enters the HUD item. This property is write-only.

onMouseExit

Assigns a function that will be called when mouse pointer exits the HUD item. This property is write-only.

onVisibilityChange

Assigns a function that will be called when HUD item visibility changes. This property is write-only.

Functions

getStringProperty(propertyName)

Attempts to get a string value from the entity's payload.

Parameters

  • propertyName Name of the property.

Returns

Property value or null if property was not found.


getNumberProperty(propertyName)

Attempts to get a number value from the entity's payload.

Parameters

  • propertyName Name of the property.

Returns

Property value or -1 if property was not found.


getVector2Property(propertyName)

Attempts to get a Vector2 value from the entity's payload.

Parameters

  • propertyName Name of the property.

Returns

Property value or (0,0) if property was not found.


getVector3Property(propertyName)

Attempts to get a Vector3 value from the entity's payload.

Parameters

  • propertyName Name of the property.

Returns

Property value or (0,0,0) if property was not found.


getVector4Property(propertyName)

Attempts to get a Vector4 value from the entity's payload.

Parameters

  • propertyName Name of the property.

Returns

Property value or (0,0,0,0) if property was not found.


getColorProperty(propertyName)

Attempts to get a color value from the entity's payload.

Parameters

  • propertyName Name of the property.

Returns

Property value or a clear color if property was not found.


getBoolProperty(propertyName)

Attempts to get a boolean value from the entity's payload.

Parameters

  • propertyName Name of the property.

Returns

Property value or false if property was not found.


setStringProperty(propertyName, value)

Adds or updates a string value in the entity's payload.

Parameters

  • propertyName Name of the property.
  • value Value to assign.

setNumberProperty(propertyName, value)

Adds or updates a number value in the entity's payload.

Parameters

  • propertyName Name of the property.
  • value Value to assign.

setBoolProperty(propertyName, value)

Adds or updates a boolean value in the entity's payload.

Parameters

  • propertyName Name of the property.
  • value Value to assign.

setVector2Property(propertyName, value)

Adds or updates a Vector2 value in the entity's payload.

Parameters

  • propertyName Name of the property.
  • value Value to assign.

setVector3Property(propertyName, value)

Adds or updates a Vector3 value in the entity's payload.

Parameters

  • propertyName Name of the property.
  • value Value to assign.

setVector4Property(propertyName, value)

Adds or updates a Vector4 value in the entity's payload.

Parameters

  • propertyName Name of the property.
  • value Value to assign.

setColorProperty(propertyName, value)

Adds or updates a Color value in the entity's payload.

Parameters

  • propertyName Name of the property.
  • value Value to assign.

copyCustomProperties(otherTarget)

Copies custom properties from one entity to another. Matching property names will be overwritten.

Parameters

  • otherTarget