Alright, hello everyone. This is a common question usually asked here on this website. I've been messing with this and it always shows this error: "ServerScriptService.Script:13: bad argument #2 to 'random' (interval is empty)"
This is the code which contains the line of code and the locals used:
local players = game.Players:GetChildren()
local randomplayer = players[math.random(1,#players)] --This is line 13 in my script
This is the only error, if you can help that would be appreciated. ;) ~Spooksletsky @Spooksletsky

3 comments
Have you checked to see if #players is zero?
I have checked if #players is zero, the function this code is in doesn't run right away. When I do run print(#players) it prints 2
Well one thing - use GetPlayers instead of GetChildren for this specific case. That won't fix it though.