How should I go about making a turn based game?

I’m planning to make a turn based game, in which players will take turns on a variety of maps. How should I go about making this?

I have this so far, but I’m not sure what to do next…

local RS = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")

while task.wait() do
	if #players:GetPlayers() == 4 then
		local playersPlaying = {} for index, player in pairs(players:GetPlayers()) do
			table.insert(playersPlaying, player)
		end
		
		
	end
end
1 Like

You could set up a loop where you wait for the current player to fire an event after their turn, or when the server loop detects they’ve taken too long.

View Reddit by TheEpicCoder – View Source

I have this code so far, but I’m not sure where to go next.

local RS = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")

while task.wait() do
	if #players:GetPlayers() == 4 then
		local playersPlaying = {} for index, player in pairs(players:GetPlayers()) do
			table.insert(playersPlaying, player)
		end
		
		
	end
end
local NUM_TO_START = 4

local Players = game:GetService("Players")
local playersPlaying = {}
local gameRunning = false


while task.wait(1) do --Making this one makes it wait 1 second, so you already have a time loop you can track with
  if gameRunning then
    --Handle code in here for checking who's turn it is and running the game code.
    gameRunning = false --Set it to false when there's a winner or the time is up
  else
    local currentPlayers = players:GetPlayers()

    if #currentPlayers >= NUM_TO_START then
      gameRunning = true
      playersPlaying = currentPlayers
    end
  end
end