Log inGet started
World

Match Flow Kit: Countdowns, Rounds and Results

README.md

MatchFlow

Runs a whole multiplayer match from one component: the lobby, a 3-2-1-GO countdown, the round with its timer, results, a break, then the next round. Put it on a synced entity (entity.spawnSynced("Match")); it needs no sibling components.

  • format picks one of eight match types: timed, firstToScore, bestOf, lastStanding, kingOfTheHill, race, waves, turnBased. Each reads a couple of fields (roundSeconds, targetScore, rounds, waves, turnSeconds, turns).
  • countdownStyle, resultsScreen, resultsLook, hudLook and lobbyLook restyle the screens. Set showUi = false to draw your own.
  • The entity's owner is in charge. It runs MatchFlow.rules and publishes the match in the synced snapshot field. Everyone else follows that snapshot and forwards their reports. If the owner leaves, the lowest remaining peer id takes over from the last snapshot and the match carries on.
  • Game code reports addScore, setScore, knockOut, finish, clearWave, endTurn and setOnHill, and listens to onStateChanged, onCountdown, onRoundEnded, onMatchEnded, onTurn and onWave.
local match = entity.spawnSynced("Match")
local m = match.component.add("MatchFlow", { format = "timed", roundSeconds = 30 })
m.events.onRoundEnded:connect(function(e) print(e.winnerName, "wins round", e.round) end)

The package README has every format, style, field and the full multiplayer behaviour.