Hello. I tried to pick an "alien" from a table of players. It's not working. The error says:
18:43:22.097 - ServerScriptService.GameScript:15: bad argument #2 to 'random' (interval is empty)
This is my code:
local playerstorage = game:GetService("Players")
local players = {}
while true do
for _, player in pairs(game.Players:GetPlayers()) do
if player and player.Character then
local humanoid = player.Character:WaitForChild("Humanoid")
if humanoid and humanoid.Health > 0 then
table.insert(players, player)
end
end
end
local alien = players[math.random(1, #players)]
wait(0.1)
end

2 comments
Thanks so much!!!!
Only one problem: multiple players are chosen!