Although this could be inefficient if it's done lots of times on large servers. A better and more efficient alternative would be to keep an active table of players and use foreach to iterate that table: