If you’ve ever played a popular Roblox game like Arsenal, Murder Mystery, or any battle royale, you’ve experienced a round-based game loop. Players wait in a lobby, the round starts with a countdown, gameplay happens, then everyone returns to the lobby to start again. Today, we’re going to build exactly that!
This system is the backbone of countless successful Roblox games, and once you understand it, you’ll be able to create all sorts of exciting experiences.
Why Use a Round-Based System?
Round-based games are popular for good reasons:
- Fresh starts: Every round gives players a new chance to win, keeping things fair and exciting
- Natural pacing: Rounds create clear breaks between action, preventing player fatigue
- Easy to expand: Once you have the loop working, you can add new maps, game modes, and features
The core concept is simple: create a loop that repeats forever, moving through different game states with timers between each state.
Setting Up Your Script
First, create a Script (not a LocalScript!) in ServerScriptService. Server scripts control game logic that all players need to see and experience together.
Let’s start with the basic structure:
while true do
print("Intermission")
wait(10)
print("Round starting!")
wait(2)
print("Round in progress")
wait(30)
print("Round ended!")
wait(3)
end
This is the skeleton of every round-based game! The while true do loop runs forever, cycling through different phases. Right now it just prints messages, but we’ll expand on this.
Adding a Status Display
Players need to know what’s happening! Let’s create a value that updates throughout the game loop. First, add a StringValue to ReplicatedStorage called “Status” (you can do this in Studio or via script).
Now let’s use it in our script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local status = ReplicatedStorage:WaitForChild("Status")
while true do
status.Value = "Waiting for players..."
wait(10)
status.Value = "Get ready!"
wait(2)
status.Value = "Round in progress!"
wait(30)
status.Value = "Round ended!"
wait(3)
end
Now you can create a TextLabel in a ScreenGui that displays this status value! This keeps your game loop and your UI separate, which is great practice.
Adding Countdown Timers
Let’s make our intermission more interesting by showing a countdown. Instead of wait(10), we’ll use a for loop to count down:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local status = ReplicatedStorage:WaitForChild("Status")
while true do
-- Intermission countdown
for i = 10, 1, -1 do
status.Value = "Next round in " .. i .. " seconds"
wait(1)
end
status.Value = "Round starting!"
wait(2)
-- Round timer
for i = 30, 1, -1 do
status.Value = "Time remaining: " .. i .. " seconds"
wait(1)
end
status.Value = "Round ended!"
wait(3)
end
The for i = 10, 1, -1 do loop counts from 10 down to 1, stepping by -1 each time. The .. operator combines strings together, letting us show the current number in our status message.
Making It Your Own
Now you have a working round system! Here’s where it gets fun. Between the status updates, you can add your actual game logic:
- During intermission: Teleport players to a lobby, restore their health, reset their tools
- When the round starts: Teleport players to the game area, give them equipment, choose teams
- During the round: Track eliminations, check for winners, spawn obstacles
- When the round ends: Determine the winner, give rewards, clean up the map
Here’s a quick example of teleporting players during the round start:
-- After "Round starting!" status
local Players = game:GetService("Players")
local spawnLocation = workspace.GameSpawn -- Create this part in your workspace!
for _, player in pairs(Players:GetPlayers()) do
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
player.Character.HumanoidRootPart.CFrame = spawnLocation.CFrame
end
end
Recap and Next Steps
Congratulations! You’ve built a working round-based game loop. You learned how to:
- Create an infinite game loop with
while true do - Use countdown timers with for loops
- Update a status value that players can see
- Structure your game into clear phases
This foundation can support almost any round-based game idea you have. Try experimenting with different round lengths, adding more phases, or creating multiple rounds before returning to intermission.
What to learn next: Try implementing a player count check (only start rounds when enough players are in the game), or explore RemoteEvents to let players vote on maps between rounds!