Best Way To Create This Round System

Hello! So recently I have been working on a CSGO/Valorant game. I have just finished everything but have been struggling with creating a round system.

What it should be like :
5v5, first team to 13 points, wins the game.

Points are achieve per team if all of the opponents team are elimated, or bomb is placed. I currently am just trying to do it without the bomb of course.

Games normally consist for about 35 minutes, their isn’t really a time limit its just first team to 13 wins/points.

What I was going to do :

Since I already have Teams ordered like this →

image

I thought I should create values like MaxPlayers, PlayersAlive, and WinScore.

MaxPlayers is already being used for TeamSelection so if it gets to 5, then it is not able to be joined.

PlayersAlive is set to 5 and I was wondering how in a script I could decrease the increment just by checking when a player dies. When it hits 0, you would increase the WinScore to the opponents team. Vise versa, a new rounds starts.

So my question is… Is this a good attempt? Since I need values I thought It would be best to put them in the team. I also am trying to do this →

image

Where as GameStatus will display on the localscript the current time span of the round so → “10:00”, “35:00” etc. Just keeps counting up from “00:00”.


Here is my code for that. Haven’t been able to test yet, this would just show the points and time left.

In the end im using ProfileService I would also want to see all the players on the winning team and award them wins to save for later.

What is the best way I can create the 5v5 round system, that is based on everything I said above? Hope you understand thankyou!

PS : I’ve looked at plenty resources and tutorials, i’m just looking for more advice on this.

Wow, that was much to read. I’ll just help you with your provided code.

So basically what you could do is .CharacterRemoving (Article) and it would look like this:

local Team = game.Teams.YOURTEAM
game.Players.PlayerAdded:connect(function(plr) 
plr.CharacterRemoving:connect(function(char)
 Team.PlayersAlive.Value = Team.PlayersAlive.Value -= 1
if Team.PlayersAlive.Value == 0 then 
local otherteam 
for i,v in pairs(game.Teams:GetChildren()) do 
if v == Team then
else
otherteam = v
end
end
otherteam.WinScore.Value = otherteam.WinScore.Value += 1
end 
end)
end)

Don’t know if anything is wrong, I’m currently on mobile.

I think .Changed doesn’t work in LocalScripts?
Use :GetPropertyChangedSignal() (Article)

2 Likes

What do you think about this attempt?

local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local WinEvent = ReplicatedStorage:WaitForChild("Events").WinGame
local GameStatus = ReplicatedStorage:WaitForChild("Values").GameStatus

local GameTime = 2100 -- 35 Minutes

local Attackers = Teams.Attackers
local Defenders = Teams.Defenders
local Spectators = Teams.Spectators

local PlayersDead = {}

--while true do
--	task.wait(1)
--	GameStatus.Value = "00:00"
	
--end

local function clearDeadPlayers() 			-- CLEARING TABLE
	table.clear(PlayersDead)
end

Players.PlayerAdded:Connect(function(plr)
	
	plr.CharacterAdded:Connect(function()
		if table.find(PlayersDead, plr.UserId) then
			plr.Team = Spectators  -- sending them to spectators
			plr:LoadCharacter()
		else
			print("not dead yet")
		end
	end)
	
	plr.CharacterRemoving:Connect(function(char)
		
		table.insert(PlayersDead, plr.UserId)
		print("player just died")
		
		if plr.Team == Attackers then
			Attackers.PlayersAlive.Value -= 1
			print("attackers just lost a player")
		elseif plr.Team == Defenders then
			Defenders.PlayersAlive.Value -= 1
			print("defenders just lost a player")
		end
		
		if Attackers.PlayersAlive.Value	== 0 then
			Defenders.WinScore += 1
			print("defenders win a point")
		elseif Defenders.PlayersAlive.Value == 0 then
			Attackers.WinScore += 1
			print("attackers jwin a point")
		end
		
	end)
	
end)

I am trying to set it up so in while true do, or the actual round part. I can easily just check the values? I’m a little confused.

1 Like

define the minutes and seconds instead like this

local Minutes = 0
local Seconds = 0

then for the timer itself you could do something like this

local function StartTimer()
repeat
if Seconds >= 60 then
Minutes += 1
Seconds = 0
else
Seconds += 1
end

if Seconds <= 9 then
DEFINETIMETEXTHERE.Text = tostring(Minutes) .. ":0" .. tostring(Seconds)
else
DEFINETIMETEXTHERE.Text = tostring(Minutes) .. ":" .. tostring(Seconds)

end
task.wait(1)
until minutes >= 35 and seconds >= 0

end)

wrote that on mobile out of memory so i mightve made some mistakes here and there

2 Likes