Search the docs

Find a guide, global, type or member

GlobalMatch

match

The running match: its map, mode, players and how to end it. Only scripts get match; content.luau does not.

The entry script runs once the arena exists and its chunks are loaded, but before any player is admitted, so match.players() is empty at the top level of main.luau. Players arrive through players.onJoin / the playerJoin event. When scripts hot-reload in dev mode, the entry script runs again and playerJoin fires again for everyone already in the match.

Functions

match.id() -> string#

This match's instance id, e.g. "coinrush-3". Unique among the server's live matches.

match.experience() -> string#

The experience id from experience.toml, e.g. "coinrush".

match.map() -> MatchMap#

The map chosen for this match. Every match has a map: with maps = "a,b" one is picked at random when the match starts, otherwise it is the single map. Never nil.

match.mode() -> string#

The mode picked for this match, one of the modes listed in experience.toml, chosen at random when the match starts. Nil when the experience lists no modes.

match.spawn() -> MatchSpawn#

The map's spawn point; the same value as match.map().spawn.

match.markers(name: string) -> { { [string]: any } }#

Markers with the given name, or an empty table when there are none. Unlike match.map().markers, each entry is flat: the marker's properties are merged into the same table as name, x, y, z and yaw, and facing is not included.

match.markerNames() -> { string }#

The distinct marker names in the map, sorted alphabetically.

match.players() -> { Player }#

The players currently in this match, as player handles. Empty until players are admitted.

match.finish(winner: (Player | string)?)#

Ends the match. Pass the winner as a player or a name, or nothing for no winner. The match shuts down on the next tick: scripts stop, the arena is removed and players go back to the lobby. Raises if the match has already finished, so call it once.