How do I create a list of all objects in scene with a tag

Basically as it says above I am trying to create a list of all the players in my game so I can create a scoreboard. They all have the “Player” tag and my idea is to have a script go and find all objects with that tag, add them to a list, and display the list. But I can’t seem to get the list to populate.

EDIT: Added my current broken code

public GameObject[] players;    

    void Start()
    {
        if (players == null)
            players = GameObject.FindGameObjectsWithTag("Player");


        foreach (GameObject player in players)
        {
            players.Add(player);
        }
    }

What your code is basically doing now is something like this:

Step 1. Check if the basket is empty or not. if not, skip Step 2.

Step 2. Collect only the Apples from the “Fruit Box”, and ram them all into the basket.

Step 3. For each “Fruit” in the basket, pull it out, and put it back.

After removing Step 1 and 3, the code should turn out like this:

public GameObject[] players;    

	void Start()
	{
		players = GameObject.FindGameObjectsWithTag("Player");
	}

Plus, the players.Add part should return an error message since there is no such Method.

Try using List instead of the Array that you are currently using.