local chosenPlayer = plrs[math.random(1, #plrs)] local chosenPlayer2 = plrs[math.random(1, #plrs] --[[ The possibility is that the same player could be selected twice, how do I make sure that it doesn't do that?]]
First we need to get a table of current players using
local players=game.Players:GetPlayers()
Then we can use math.random() to choose a player, using players[i] and then remove that player from the table using its index so that we can't choose it again.
local players=game.Players:GetPlayers() local n=math.random(1,#players) local player1=players[n] table.remove(players,n) n=math.random(1,#players) local player2=players[n]
I use the variable n so that I can choose a player and remove with since that is the index.