Skip to main content

HudTimer

Provides properties and functions to interact with a HudTimer.

Properties​

time​

Timer's value. This property is read-only.

isRunning​

True if the timer is currently counting. This property is read-only.

isActive​

True if the timer is currently running or paused. This property is read-only.

truncate​

True if the timer should truncate decimal time values.

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.

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​

start()​

Starts the timer.


startCountdown(time)​

Starts the timer. Counts down from the provided value.

Parameters​

  • time — Time to start counting down.

stop()​

Stops the timer.


pause()​

Pauses the timer. Calling start on this timer will make it continue from its last value.


reset()​

Resets the timer. Timer will stop and be set to 0.


addTime(time)​

Add time to the timer.

Parameters​

  • time — Amount of time to add or subtract.

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 —