How do I make a turn based game?

Hi, I’m trying to make a turn based game, similar to Civilization series mechanics. However, I’m not too clear on the logic path of trying to make one, and instead I made a primitive system of my idea which still doesn’t work. Perhaps anyone can guide me on trying to make such a system? Mind you, I’m not too good with tables if the system requires it, so I’ll try my best to keep up.

Here’s my script and I’m ready to face every sort of criticism for this haha:

local RS = game.ReplicatedStorage
local TurnFolder = RS.TurnSystem
local EVENT = RS.Turn
local Team = TurnFolder.TurnTeam

EVENT.OnServerEvent:Connect(function(PLAYER, TEAM) -- if someone presses next round button

	if TEAM == "Blue" then
		Team.Value = "Red"
	else
		if TEAM == "Red" then
			Team.Value = "Yellow"
		else
			if TEAM== "Yellow" then
				Team.Value = "Blue"
			end
		end
	end
end)



Team.Changed:Connect(function() -- this is the issue. It's the check whether if there are no players in the team, which will make the game skip the team

	local Teams = game:GetService("Teams"):GetTeams()
	for _, team in pairs(Teams) do
		local players = team:GetPlayers()
		if #players == 0 then
			print(team.Name .. " has no players")
			if team.Name == "Blue" then
				Team.Value = "Red"
				wait(1)
			else
				if team.Name == "Red" then
					Team.Value = "Yellow"
					wait(1)
				else
					if team.Name == "Yellow" then
						Team.Value = "Blue"
						wait(1)
					end
				end
			end
		end
	end
end)


Okay, I’ve made the script working, but it seems very much a very inefficient system. Can anyone give me any ideas on how to improve this?

EVENT.OnServerEvent:Connect(function(PLAYER, TEAM)

	if TEAM == "Blue" then
		Team.Value = "Red"
	else
		if TEAM == "Red" then
			Team.Value = "Yellow"
		else
			if TEAM== "Yellow" then
				Team.Value = "Blue"
				TurnNumber.Value = TurnNumber.Value + 1
			end
		end
	end
end)


Team.Changed:Connect(function()

	local Teams = game:GetService("Teams")
	
	local RED = Teams:FindFirstChild("Red")
	local BLUE = Teams:FindFirstChild("Blue")
	local YELLOW = Teams:FindFirstChild("Yellow")
	
	local REDPlayer = RED:GetPlayers()
	local BLUEPlayer = BLUE:GetPlayers()
	local YELLOWPlayer = YELLOW:GetPlayers()
	print(#BLUEPlayer)
	print(#REDPlayer)
	
	if Team.Value == "Blue" and #BLUEPlayer == 0 then
		print("Skipping Blue")
		Team.Value = "Red"
	end
	
	if Team.Value == "Red" and #REDPlayer == 0 then
		print("Skipping Red")
		Team.Value = "Yellow"
	end
	
	if Team.Value == "Yellow" and #YELLOWPlayer == 0 then
		print("Skipping Yellow")
		Team.Value = "Blue"
		TurnNumber.Value = TurnNumber.Value + 1
	end
	
end)```