Skip to main content

HudButton

Provides properties and functions to interact with a HudButton.

Properties​

text​

The text content of the item.

textColor​

The text color of the item. This will override foregroundColor property.

fontStyle​

Font style of the item.

fontSize​

Font size of the item.

textAlignment​

Alignment or anchoring of the text.

position​

The position of the item on-screen.

orientation​

The rotation of the item on-screen Indicates a 90-degree rotation 0 - 0 degrees 1 - 90 degrees 2 - 180 degrees 3 - 270 degrees.

size​

The size of the item.

anchorMin​

The min anchor of the item.

anchorMax​

The max anchor of the item.

pivot​

The pivot of the item.

foregroundColor​

Foreground color of the item.

backgroundColor​

Background color of the item.

borderColor​

Border color of the item.

borderRounded​

Indicates whether the item has a rounded border.

borderRadius​

Radius values for rounding individual item corners. Starts from the top-left and goes clockwise.

borderWidth​

Width of outline around the item.

anchor​

The anchors of the item. Sets both min and max anchors.

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.

onClick​

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

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 —