I'm trying to create a player randomizer for a game, and this is my code:
local tbl = {}
local players = game.Players:GetChildren()
table.insert(tbl, players)
print(tbl[math.random(1, #players)])
What's wrong here? The error I'm getting is: "ServerScriptService.Script:5: bad argument #2 to 'random' (interval is empty)"

4 comments
I am just getting the same error message.
I updated my answer, see if adding that fixes it.
Instead of looping, you could use the PlayerAdded event and the power of the Wait method to wait until there is more than one player in the server(game.Players.PlayerAdded:Wait()). Second of all, you should not use :GetChildren() on the Players service; you should be using :GetPlayers() instead.
thanks guys! it worked.