Skip to content

Round

The round represents the current state of the game. There is only ever one round at a time; you can get the current round in code using the GetRound API.

type VictoryData = {
Victor: Victor,
DidTimeout: boolean,
EndedAt: number,
Music: Sound?,
},
NameTypeDescription
GamemodeGamemodeDefinitionThe current gamemode. Readonly.
Extras{[any]: any}Extra information about the round.
Highlights{[string]: Highlight}The highlights for the round. The key is the highlight group.
ElapsedPhaseTimenumberThe amount of time that has passed in the current phase. Resets when the phase changes.
PhaseLengthnumberThe max duration of the current phase.
VictoryDataVictoryData?The victory data for the round. Readonly.
MinimumRequiredPlayersnumberThe minimum number of players required to start the game. This gets set by the gamemode when the round first loads.

Returns the item definition given the name of the item. When an maps and gamemodes define items with the same name, map item definitions are prioritised over gamemode item definitions.

NameTypeDefaultDescription
namestringThe name of the item.

AnyItemDefinition?

Returns the ammo definition given the name of the ammo. When an maps and gamemodes define ammo with the same name, map ammo definitions are prioritised over gamemode ammo definitions.

NameTypeDefaultDescription
namestringThe name of the ammo.

AnyAmmoDefinition?

Returns a defined interactable given the name of the interactable. When an maps and gamemodes define interactables with the same name, map interactable definitions are prioritised over gamemode interactable definitions.

NameTypeDefaultDescription
namestringThe name of the interactable.

InteractableDefinition?

Loads a map.

NameTypeDefaultDescription
mapMapThe map.

Returns the current map. Errors if no map is loaded (which should never happen).

Map

Returns a dictionary of all MapObjects to loaded Items.

{[MapObject]: Item}

Returns the Item given the MapObject. Returns nil if the item is not loaded.

NameTypeDefaultDescription
MapObjectMapObjectThe map object.

Item?

Creates a new Item and optionally associates it with a model.

NameTypeDefaultDescription
componentsItemComponentsThe components to use as a base.
mapObjectMapObject?The item model.

Item

Creates a new Item from the given model. The model’s name is used to determine what components to use. If no item with this name can be found, an error will be thrown.

NameTypeDefaultDescription
mapObjectMapObjectThe item model.

Item

Returns a dictionary of all MapObjects to loaded AmmoBoxes.

{[MapObject]: AmmoBox}

Returns the AmmoBox given the MapObject. Returns nil if the ammo box is not loaded.

NameTypeDefaultDescription
MapObjectMapObjectThe map object.

AmmoBox?

Returns a dictionary of all MapObjects to loaded Props.

{[MapObject]: Prop}

Returns the Prop given the MapObject. Returns nil if the prop is not loaded.

NameTypeDefaultDescription
MapObjectMapObjectThe map object.

Prop?

Loads a prop given a MapObject. If the prop is already loaded, returns the existing prop.

NameTypeDefaultDescription
MapObjectMapObjectThe map object.

Prop

Returns a dictionary of usernames to participants.

{string: Participant}

Returns the participant given the username, player object, character model, or instance of their character model. Returns nil if the participant is not found.

NameTypeDefaultDescription
identifierInstance | stringThe participant’s name, player object, character model, or instance of their character model.

Participant?

Loads a player to the round, optionally with karma. Returns the participant.

NameTypeDefaultDescription
playerPlayerThe player to load.
karmanumber?1000The player’s karma.

Participant

Removes a participant from the round.

NameTypeDefaultDescription
participantParticipantThe participant to remove.
isRejoiningbooleanTrue if this participant is going to be re-added after being removed.

()

Adds an event to the event log. Note this accepts event data, not events.

NameTypeDefaultDescription
eventRoundEventDataThe event to add.

()

Returns the event log. Note, the event log does not store event data, but rather events.

{Event}

Adds a highlight to the round. Highlights are stored by group - if a highlight group already exists, it will be overwritten if the new highlight has a higher priority.

NameTypeDefaultDescription
highlightHighlightThe highlight to add.

()

Returns the current phase of the round.

Phase

Changes the phase of the round, for a specified duration, with an optional callback. Preparing, playing, and highlights phases have default callbacks; intermission and waiting do not.

NameTypeDefaultDescription
phasePhaseThe phase to change to.
durationnumberThe duration of the phase.
callback`false() -> ()?`

()

Returns true if the round is in the waiting or preparing phase.

boolean

Returns true if the round is in the playing phase.

boolean

Returns true if the round is in the highlights or intermission phase.

boolean

Pauses or unpauses the round.

NameTypeDefaultDescription
pausedbooleanWhether to pause or unpause the round.

()

Returns true if the round is paused.

boolean

Ends the round with a victory for a certain participant or role. Also specifies if the round ended in a timeout.

NameTypeDefaultDescription
victorVictorThe victor of the round.
didTimeoutbooleanTrue if the round ended in a timeout.

()

Returns the role given the role name. Errors if the role is not found.

NameTypeDefaultDescription
roleNamestringThe role name.

Role

Returns all participants with a certain role.

NameTypeDefaultDescription
roleRoleThe role.

{Participant}

Sends a message (notification or chat message) to a player or group of players.

NameTypeDefaultDescription
to{Player} | Player?all playersThe players to send the message to.
messagestringThe message to send.
kindMessageKind?"All"The kind of message to send.

()