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.
formatpicks 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,hudLookandlobbyLookrestyle the screens. SetshowUi = falseto draw your own.- The entity's owner is in charge. It runs
MatchFlow.rulesand publishes the match in the syncedsnapshotfield. 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,endTurnandsetOnHill, and listens toonStateChanged,onCountdown,onRoundEnded,onMatchEnded,onTurnandonWave.
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.