Setting up sequence of game modes

hello! im sure you’ve heard about GODS WILL on roblox right? or any squid game game. Well you see how the minigames go after and after them and there are some small transition? How would i make that, i have no idea where to start (also if possible check if there are 15 players before beginning)

and sorry for my mistakes and the weird title i am not a native english speaker

local Players = game:GetService("Players")

local minigameDuration = 10
local minPlayers = 15

while true do
	local players
	
	repeat
		task.wait()
		players = Players:GetPlayers()
	until #players >= minPlayers
	
	-- you can pick a random minigame with math.random
	-- do stuff with players
	-- you can make a function that loads the minigame map
	
	task.wait(minigameDuration)
end

You can make a main loop and the comments are just ideas.

i mean like with an ending and only 6 minigames, idk how would i do it

The code they provided is pseudo code and is meant to help you get an understanding of how to implement this. Scripting support isn’t for people to write code for you.

you would do the ending code after waiting the minigame duration

local Players = game:GetService("Players")

local minigameDuration = 10
local minPlayers = 15

while true do
   local players
   
   -- Changed this so it doesn't constantly get all players 
   --and instead waits for the player added signal
   repeat
   	Players.PlayerAdded:Wait()
   until #Players:GetPlayers() >= minPlayers
   
   -- you can pick a random minigame with math.random
   -- do stuff with players
   -- you can make a function that loads the minigame map
   
   task.wait(minigameDuration)
   -- Some ending function
end

I know that “Scripting support isn’t for people to write code for you.” I just wanted some indications, but that wasnt what i was going for. I dont want a infinite loop. Only 5 minigames picked randomly then the ending. I know i could edit this code but i dont know how.

You can pick the minigames from a table with math.random

local minigames = {
    "SomeMinigame",
    "AnotherMinigame",
    "FunMinigame"
}

local function getRandomMinigames(numberOfGames: number)
    local selectedGames = {}

    for _ = 0, numberOfGames do
        table.insert(selectedGames, minigames[math.random(1, #minigames)])
    end

    return selectedGames
end

You can tie functionality to the minigames in a multitude of ways, but the main idea is you use the strings you got from the minigames table to figure out which minigame to perform.

I dont understand how this work, could you explain it ?

It’s a function that returns a table with randomly selected minigames from the minigames table, which contains strings that correspond to different minigames. You call it like this:

local minigames = getRandomMinigames(5)

It’s up to you to tie functionality to the minigames

but how would i make the script play only 5 minigames only, sorry if you already said that i didnt catched it because you added two variables called minigames soo i dont know which one it is