Hey! For the past couple of days i’ve been trying to figure out how to make a tournament system. I have come up with some concepts but not quite sure how to apply it.

I will begin by showing you what I am trying to figure out.

```
local TournamentTable = {
["Round 1"] = {
[1] = {
Player1, -- If this player leaves then
Player2 -- Player2 Wins
},
[2] = {
Player3, -- Player3 loses
Player4 -- Player4 Wins
}
},
["Round 2"] = { -- Move onto round 2 once Round 1 Duals are over
[1] = { -- Only 1 dual since there are 2 players remaining
Player2,
Player4
},
}
}
```

I’m not too sure how to calculate how to put 2 players into a Dual and then another 2 into another. Then lets says theres 3 players which would be an uneven amount, they would not be put into the table.

What I have done so far:

```
function Gamemode:Tourney()
CreateTourneyTable() -- Creates a Tournament table like shown above ^
-- However it has all possible Rounds + Duals so it's not based on the amount of players
local Dual = 1 -- This will be the Dual Number
for Index, Player in pairs(self.PlayersTable) do -- Loop through the players table
self.TourneyTable["Round 1"]["Dual "..Dual][Player] = true -- Add them to the current Dual
if #self.TourneyTable["Round 1"]["Dual "..Dual] == 2 then -- This doesn't work, but I need to check if there is already 2 players in that duel
Dual += 1 -- If there is +1 to the current Dual
end
end
print(self.TourneyTable) -- Print the Table
end
```

This doesn’t seem to work in the sense that it doesn’t know how many players are in a duel.

**TL;DR:** Trying to figure out why my current Tournament system doesn’t work, and if there is any other way I can make a functioning one.