If you’re running this right when the game starts, the player may not have joined when the server gets the number of players in the game. Try waiting for a player to join like this:
local Players = game.Players
if #Players:GetPlayers() < 1 then
Players.PlayerAdded:Wait()
end
local RandomPlayer = Players:GetPlayers()[math.random(#Players:GetPlayers())]
print (RandomPlayer)
It doesn’t need to though. I thought the same thing awhile ago and it even seemed weird to only do it with one parameter, but you can. If you just pass in a single number you’ll get a random number from 1 to that number.