Basically I have a team where everybody starts as, and 2 players that are randomly selected from this team will play a game and this'll happen until there's nobody in the team that everybody started at.
local teams = game:GetService("Teams") local matchmaking = teams:WaitForChild("Matchmaking") local round1 = matchmaking:WaitForChild("Round 1") local round2 = matchmaking:WaitForChild("Round 2") local round3 = matchmaking:WaitForChild("Round 3") wait(10) for i, v in pairs(game.Players:GetPlayers()) do if v.Team == game.Teams["Not Playing"] then local noteam = game.Teams["Not Playing"] local chooseplayers = noteam:GetPlayers() -- I don't know if this is correct local Chosen1, Chosen2 = math.random(1, #chooseplayers) repeat Chosen2 = math.random(1, #chooseplayers) until Chosen2 ~= Chosen1 print(chooseplayers[Chosen1].Name) print(chooseplayers[Chosen2].Name) end end
Thanks,
LukeGabrieI
local team = game:GetService("Teams"):FindFirstChild("Not Playing") local playersInTeam = team:GetPlayers() if #playersInTeam > 0 then -- make sure there are players in this team local player1 = playersInTeam[math.random(1, #playersInTeam) local player2 = playersInTeam[math.random(1, #playersInTeam) if player1 ~= player2 then print(player1.Name) print(player2.Name) end end
Might wanna wrap this in a while/repeat loop, or an event so it runs multiple times.