local rp = gt[math.random(1,#gt)]
So now i have the random player, but how do i get the rest of them? I want everyone else than the random player
local rp = gt[math.random(1,#gt)]
So now i have the random player, but how do i get the rest of them? I want everyone else than the random player
If you want everyone other then 1 player it would be somewhat like this,
for _,Player in pairs(gt) do -- For all the players
if not Player == rp then -- If player is not the randomly selected player
--Etc.
end
end
or if you wanted them to be in a table,
local OtherPlayers = {}
for _,Player in pairs(gt) do
if not Player == rp then
table.insert(OtherPlayers, Player)
end
end
'OtherPlayers' now has every player but your random one.
for i, v in pairs(gt) do
if v == rp then
gt:remove(i)
break
end
end
Now, gt only contains unselected players.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
But @Frostftw could you make that if everyone else than that random player have their health to 0 then it would disable a script? could you make that