I am trying to make it so it picks a random player from the players table. It isn't working. Here is my code:
local plrs = {}
for _, v in pairs (game.Players:GetChildren())do
table.insert(plrs, v)
print(v)
end
while true do
wait()
local chosenplr = plrs[math.random(1, #plrs)]
print(chosenplr.Name)
end
Error: ServerScriptService.PlrTurnScript:9: invalid argument #2 to 'random' (interval is empty)

2 comments
ye that doesnt work
oh i forgot i rushed on it im sorry i will try it n studio sty here