Heya There!
I’m creating a round system for both two separate games and I’m wondering how I would go on formatting a system. Basically, I want to know how to make a generally good round system with everything explained. If you don’t know what I mean, I’d want the replies to be something like this:

(I’d also like you to explain how the scripts work and maybe what to put in there)
1 Like
The best way to create a round system in my opinion is by doing a
for i = 1, TIMELIMITSECONDS do
-- code
end
Obviously the code works separately for each game
That’s not what I’m exactly looking for and besides, you only provided me a small snippet of, I suppose, the main round system or something
You didn’t explain well enough then. You need to elaborate more
this is VERY dependent on what game you’re making.
for example, in most asymmetrical horror games (most well-known example rn is forsaken if we’re only going by roblox games), there’s a time limit until the round ends that lets the survivors win, or if the killer kills everyone, the round ends and the killer wins.
however, in a game like arsenal, the game ends once someone reaches the last gun because players have infinite respawns and there’s no time limit. checking for this is WAY different from simply checking if no one is a survivor anymore or if a time limit ran out.
the most universal example of a round system module i can think of is to just have a module create a round object (via metatables and such) and end it later once a condition is met, then choose a winner. but that wouldn’t really solve anything since you could easily do the same thing without using modules at all.
Welp, since a round system is mainly focused on loops, you could use that RoundHandler script to manage that:
RoundHandler
local plrs = game:GetService("Players")
local RpS - game:GetService("ReplicatedStorage")
local mapsFolder = RpS.MapsFolder -- The place where it is located all the maps
local currentMaps = mapsFolder:GetChildren() -- All maps in the game
local TIMELIMIT = 30 -- The time limit, in seconds, to wait for the round.
local PLAYERMIN = 5 -- The minimum player required to start the round.
local ROUNDTIME = 60 -- The duration, in seconds, from which the current round will stop
local RoundHandler = {}
function RoundHandler.StartCountdown(manager : (index : number) -> (), limit : number?) : ()
limit = limit or TIMELIMIT
for index = limit, 0, -1 do -- Start the timer
manager(index) -- You can pass this function 'manager' as a parameter to this function, representing anything you want to happen while in the loop.
end
end
function RoundHandler.Start(map: folder?, timeToFinish : number?, minPlayer : number?) : boolean
minPlayer = minPlayer or PLAYERMIN
if minPlayer < #plrs:GetPlayers() then -- If players quantity is not sufficient
return false
else
--[[ If you want random maps you can try making something like that:
if not map then
map = currentMaps[Random.new():NextInteger(1, #currentMaps)]
end
]]
map.Parent = workspace -- Move map to workspace
--anything regarding round functions you add here. If you want help with that tell me.
RoundHandler.End(map, timeToFinish) -- End round after 'timeToFinish' seconds
return true
end
end
function RoundHandler.End(map : folder, timeToFinish : number) : ()
task.wait(timeToFinish)
map.Parent = mapsFolder -- Move map to the folder again
end
return RoundHandler
GameHandler
local roundHandler = require(script.RoundHandler)
while true do
roundHandler.StartCountdown(function(index) -- Start countdown
print("Countdown:", index) -- Print the current time
end)
local success = roundHandler.Start() -- Start round
if not success then -- If couldn't start round
print("Couldn't start round! Re-starting!")
end
end
This is already a step for creating a round-system-like game. Please note I didn’t provide everything, such as player TP, round functions, and others, because that’s up for you. If anything’s wrong with the script, tell me.
local timeOfRound = 0
while true do
timeOfRound+=1
task.wait(1)
end
- That literally a programming warcrime spending memory on completely useless operation when work around with os.clock() will tell you ACTUAL TIME that elapsed without weird skipping;
Sure you can make it like timeOfRound+=task.wait(1)
but that is still a warcrime non the less.
My method of creating a round system, which has always worked, is changing the value of an IntValue that a local script will pick up spontaneously and make local changes, and a boolvalue to monitor the round status, all done within a spawned timer function. I won’t be delving into the round-related functions, since those depend on the game
—Round Handler
local RoundModule = {}
local roundfuncs = require(script.Parent.RoundFunctions)
local timeval = game.ReplicatedStorage.TimeVal
local roundstart = game.ReplicatedStorage.RoundStarted
local intermission = 10
function RoundModule.Timer()
while true do
for i = intermission,1,-1 do
timeval.Value = i
task.wait(1)
end
roundstart.Value = true
— Some function to start the round from the module required above
roundstart.Changed:Wait()
end
end
You can make round start false again in a round function to end the round
—Local script in startergui
local timeval = game.ReplicatedStorage.TimeVal
local timelabel = — Text label to display waiting time here
timeval.Changed:Connect(function()
timelabel.Text = timeval.Value
end)
Require the round module in GameHandler, and do spawn(RoundHandler.Timer)
so the script doesn’t get stuck in the while loop