local mode = true game.Players.PlayerAdded:connect(function(plr) if mode == true then plr.TeamColor = game.Teams["Humans"].TeamColor else plr.TeamColor = game.Teams["Creepers"].TeamColor end end) while true do wait(1) if game.Players.NumPlayers > 1 then print "Starting game" for i = 5, 1, -1 do print(i .. " seconds until night") wait(1) end print "Night Begins" local Plrs = game.Players:GetPlayers() local creeper = Plrs[math.random(1,#Players)] print('Selected player was: ' ..creeper.Name) else print "There needs to be 2 players to start" end end
script breaking at chosing random players?
You never stated what Players was.
Line 28. You need a table containing a list of players.