Best Way To Do A Round System

I’m not asking for any sort of code, I just want to see what people have to say. I have seen a couple of methods to combat a round system but they don’t seem reliable enough. Thanks!

What kind of specific round system do you want to make?

Not really,
I’ve used and seen this method a lot but it just doesn’t seem reliable enough:

local intermission = 15
local round = 45

while true do 
	round = 45
	while true do 
		intermission -= 1
		wait(1)
		if intermission <= 0 then 
			break
		end
	end
	intermission = 15
	while true do 
		round -= 1
		wait(1)
		if round <= 0 then 
			break
		end
	end
end

What’s the use of that? Why can’t you just do something like just:

local intermission = 15
local round = 45

while true do
	task.wait(intermission)
	-- DO STUFF
	task.wait(round)
end
1 Like

Well something, as I posted, would be easier to add on to. For example, say I wanted to check if there were no players alive and then stop the round there, I couldn’t do so with the example you provided. The reason I made this post was just to see what people thought about it…

1 Like

I came up with this script from my head, haven’t tested it yet but theoretically this should work:

local PS = game:GetService("Players")

local intermission = 15
local round = 45
local players = {}
local roundDebounce = false

local function RoundWait(val)
    for i = 1,val do
        if roundDebounce == false then
            warn("ROUND ENDED")
            break
        end

        task.wait(1)
    end
end

local function CheckPlayers()
    for i,v in ipairs(PS:GetPlayers()) do
        local char = v.Character
        local hum = char:FindFirstChildWhichIsA("Humanoid")

        if not table.find(players, v.Name) then
            table.insert(players, v.Name)
            
            hum.Died:Connect(function()
                table.remove(players, table.find(players, v.Name))

                if #players == 0 then
                    roundDebounce = false
                end
            end)
        end
    end
end

local function RoundStart()
    roundDebounce = true

    RoundWait(intermission)

    CheckPlayers()
    RoundWait(round)

    roundDebounce = false
end

while true do
	if roundDebounce == false then
        RoundStart()
    end
end

Personally, I would use for i = a,b for waiting instead of a while true loop.

4 Likes

This is very interesting! Definitely not a way I’ve seen before. I’m going to continue to do research on it and find more ways people tackle a round system. Thanks a lot, means a lot!

1 Like