local players = game.Players:GetPlayers()
local evilyozy = table.find(players, game.Players:FindFirstChild("EvilYozy"))
if evilyozy then
table.remove(players, evilyozy)
end
if #players < 1 then
local randomplayer = players[math.random(1, #players)]
if randomplayer.Character and randomplayer.Character:FindFirstChild("Head") then
-- some other code
end
else
print("Positional Laser: No players were found!")
end
The code is supposed to choose a random player and run code with that player but it canât choose a player named âEvilYozyâ. If there are no players in the game other than EvilYozy then it will print âPositional Laser: No players were found!â However, when no players are found, it just says âinvalid argument #2 to ârandomâ (interval is empty)â and doesnât work. How do I make it so that the print statement happens if only EvilYozy is in the game but the code will fire for a random player if there is at least one other player in the game?