getting a GameObject array of all the connected players

Hello everyone, I am makeing a proceduraly generated terrain for a multiplayer game that will hopefully allow miles and miles of terrain to explore. up to now i have a script that can create a series of seamless chunks at a certain point, but i am missing a way to get an array of all the players’ positions. I have tried a few ways but its been basicaly throwing shit at the wall to see what sticks. If you guys have any idea on how to do this pls tell me. thanks to all of you.

Make a variable

public GameObject players;

if all players start at the same time.
in your void Start ()
type the line
players = GameObject.FindGameObjectsWithTag (“Player”);
if they log in and out, put that line in void Update ().

to access each GameObject just write in your update or a function/coroutine
foreach (GameObject go in players)

then set it to do whatever.
just make sure to reference each one as ‘go’ in that function not ‘players’