So i’m creating a random player selector.
How could I exclude someone from this? I’m going to be excluding my username
local randomPlayer = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]
So i’m creating a random player selector.
How could I exclude someone from this? I’m going to be excluding my username
local randomPlayer = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]
if not randomPlayer == “crolaa” then
– do the thing
end
you could turn that variable into a function, then under that function, you can loop call that function using while wait() do
.
in the while loop, you can check to see if your name was picked.
if your name was picked, then create a reroll, and if it’s not your name, then break the loop.
local Players = game:GetService'Players'
local PlayersTable = Players:GetPlayers()
for i, Player in pairs(PlayersTable) do
if Player.Name == "crolaa" then
table.remove(PlayersTable, i)
end
end
local randomPlayer = PlayersTable[math.random(#PlayersTable)]
This works, Thank you very much. Although next time try not to spoon feed me haha