Hello! So I'm trying to make a system that randomly chooses several players to be inserted into a table. Say I want to put 10 players into a table randomly, how do I do that? (It can't select the same player twice)
I've tried to do this:
local Players = game:GetService("Players")
local Murderers = {}
local Civilians = {}
function AssignTeams()
local Player = Players:GetPlayers()
repeat
table.insert(Murderers, Players[math.random(1, #Players)])
table.insert(Civilians, Players[math.random(1, #Players)])
until #Murderers == 2 and #Civilians == 10
end
AssignTeams()
Even if it does works, I want to find a more efficient (if possible, more effective) way to do this. Cheers!

4 comments
I edited my answer. I just released I had to do the table,index,value on table.insert
Alright, thank you! I can finally sleep in peace.
:GetPlayers gives you table copy, you can modify that
@imKirda Oh, ok.