Every party game needs a referee. In this episode you build the lobby and the invisible loop that runs round after round, waits for players, counts down and launches the match. By the end you have a working game shell other players can join.
Lumo says: this is a bigger project than the obby, so we build it in three episodes. Do them in order. Episode 1 makes the game run, Episode 2 makes the maps, and Episode 3 adds the pushing and the final.
๐ฆ
Prefer to lay it out visually? The Roblox Mod Studio lets you place platforms and scripts in the browser, then download a model to drop into Studio. Every code block also has a Copy button.
1
๐งฐ
Set Up the Project
Create the folders, the shared Config and the RemoteEvent the game talks through
Active
๐ฏ
Goal for this step
Get a clean project structure so the server and the player screens can talk to each other.
๐จโ๐ง
Parent note: Roblox games have two halves. The server runs the rules, and each player's computer runs the client. They swap small messages through a RemoteEvent. This step sets that up.
Build the structure
1Open Roblox Studio with a new Baseplate. Delete the Baseplate and the SpawnLocation.
2In ReplicatedStorage, right-click and add a RemoteEvent. Rename it ObbyEvent.
3In ReplicatedStorage, add a ModuleScript called Config. This holds all your tuning numbers in one place.
4In ServerScriptService, add a Script called ObbyServer.
5In StarterPlayer → StarterPlayerScripts, add a LocalScript called ObbyClient.
Config (ModuleScript)
-- ReplicatedStorage/ConfiglocalConfig = {}
Config.MIN_PLAYERS = 2-- need this many to startConfig.START_COUNTDOWN = 15-- seconds in the lobbyConfig.ROUND_TIME = 150-- seconds per roundConfig.WALK_SPEED = 24returnConfig
๐ก
A ModuleScript is a box of code you can require() from anywhere. Keeping the numbers here means you change them once, not in ten scripts.
๐ง
Knowledge Check
+15 XP
Where does the server script live, the one that runs the rules?
AStarterPlayerScripts
BServerScriptService
CReplicatedStorage
2
๐๏ธ
Build the Lobby
A big floating platform where players wait, and code that places them on it
Locked
๐ฏ
Goal for this step
A safe platform high in the sky, and a helper that moves any player onto it.
1Insert a Part. In Properties set Size to 70, 2, 70 and Position to 0, 600, 0.
2Tick Anchored so it never falls. Rename it LobbyFloor.
3Now the code: when a player joins, we load their character and move it to the lobby.
ObbyServer (Script)
localPlayers = game:GetService("Players")
-- players do not spawn on their own; we move themPlayers.CharacterAutoLoads = falselocallobbyCF = CFrame.new(0, 605, 0) -- above the floorlocalfunctionplaceAt(player, cf)
localcharacter = player:LoadCharacterAsync()
character:PivotTo(cf)
returncharacterendPlayers.PlayerAdded:Connect(function(player)
placeAt(player, lobbyCF)
end)
๐ง
Stuck? If players fall through the air, check the floor is Anchored. If nobody appears, check CharacterAutoLoads is set to false (that is lowercase, not "false").
๐Fill in the Concept+15 XP
Players wait in the until there are enough of them. When the match is about to start, a short ticks down.
๐ง
Knowledge Check
+15 XP
Why do we set CharacterAutoLoads = false?
ASo we control when and where each player spawns
BTo make the game load faster
CTo stop players from jumping
3
๐
The Match Loop
One forever-loop that runs the whole game, stage by stage
Locked
๐ฏ
Goal for this step
An endless loop that repeats the match forever, changing a "phase" as it goes.
Real party games never stop. When one match ends, the next begins. We do that with a while loop and a phase word that tells us where we are:
Why while true? It means "keep doing this forever". Each time round the loop is one whole match. Changing phase is how the game knows which stage it is in.
โจ๏ธ
Code Challenge
+20 XP
Fill in the three blanks that make the loop run forever:
dorunRound()
Hint: the keyword that starts a loop, the value that is always true, and the keyword that closes a block.
๐ข
Put the phases in order
+15 XP
Click the match phases in the order the game runs them:
Lobby (wait for players)
Countdown
Race
Final
๐ง
Knowledge Check
+15 XP
What does the phase variable tell us?
AHow many players are online right now
BWhich stage of the match we are in
CHow much time is left
4
โฑ๏ธ
Wait, Count Down, Launch
Fill in the two helper functions that start a match
Locked
๐ฏ
Goal for this step
Wait until 2 players are ready, show a countdown, then send everyone to the course.
1waitForPlayers just waits until the player count reaches Config.MIN_PLAYERS.
2countdown ticks from 15 to 0, writing the number onto a player attribute so every screen can show it.
What is an attribute? A tiny value you stick onto a player or a part. It copies to every player's screen automatically, so the client can read player:GetAttribute("Countdown") and show it. No messages needed.
๐ง
Knowledge Check
+15 XP
How does the countdown reach every player's screen?
AWe print it in the Output window
BWe set a player attribute the client reads
CWe change the Lighting properties
5
๐
Run One Round
A placeholder round that moves everyone to the course and back
Locked
๐ฏ
Goal for this step
A real round function that the loop can call. Episode 2 builds the actual course it drops you onto.
1Make a start platform far away, for example a Part at 0, 0, 0 sized 30, 2, 22.
2Set startCF to a CFrame above it, then move every player there at the start of a round.
ObbyServer (Script)
localstartCF = CFrame.new(0, 5, 0)
localfunctionrunRound()
for _, playerinipairs(Players:GetPlayers()) doplaceAt(player, startCF) -- onto the courseplayer:SetAttribute("Running", true)
endtask.wait(Config.ROUND_TIME) -- the race would run herefor _, playerinipairs(Players:GetPlayers()) doplayer:SetAttribute("Running", false)
endend
๐ก
Right now the round just waits. That is on purpose. Episode 2 replaces the empty wait with a real course you race across.
โจ๏ธ
Code Challenge
+20 XP
Loop over every player and move them to the start:
Hint: the iterator for a list, and the object that describes a position and facing.
๐ง
Knowledge Check
+15 XP
What does CFrame.new(0, 5, 0) describe?
AA colour
BA size of 0 by 5 by 0
CA position in the world, 5 studs up
6
๐งช
Test With Two Players
Run the game with a second player and watch a full loop
Locked
๐ฏ
Goal for this step
Confirm the loop works: two players, a countdown, then both get moved to the course.
1Click Test at the top, then Clients and Servers, and set Players to 2.
2Click Start. You should see two characters standing on the lobby floor.
3Within a second the countdown starts. When it hits 0 both players jump to the course platform.
4After 150 seconds the round ends and the loop begins again. That is one full match.
๐ง
Nothing moves? Check the Output window for red errors. The most common one is a typo in a function name, or a Config value that is still a string.
๐จโ๐ง
Try this together: change Config.START_COUNTDOWN to 3 and start again. The match begins much faster. That is the power of keeping numbers in one Config file.
๐ง
Knowledge Check
+15 XP
How many players must be present before the match starts in this episode?
A2, set by Config.MIN_PLAYERS
B8, one for each episode
CAt least 10
๐โจ๐โญ๐
The Loop Runs!
You built a lobby, a match loop and a countdown that launches a round. The game now runs itself. Next: Episode 2 builds the three maps that make every match different.
0
Total XP
1
Level
0
Best Streak
0%
Accuracy
๐น๏ธ
Build it in the browser first
Try this project step by step right here: write the code, watch it run, then download it and keep building in your engine.