How to "FindWithTag" multiple items?

I know there are a few other threads about it and I’ve mostly pieced together the information but I’m still a bit of a beginner in coding so I was wondering if someone could help me put together this last bit.

Okay, so I’d like to say, I know i can link up items in the inspector, but honestly I don’t want to do it that way. I always seem to get into the situation where I’ve linked up all these inspector things then I accidentally infinite loop myself and my game breaks and I’m scouring every folder linking everything back up… And even if you want to tell me to do it that way, I really want to know how because I can already see this applying in future situations.

I know you have to use some sort of array right? Basically I have three GUIText. One is my “Score.” One is my “Game Over!” and one is my “Click here to restart”

I know how to find a single GUI Text

    GameObject guiTextObject = GameObject.FindWithTag("Text"); 
    if (guiTextObject != null)
    { 
        scoreText = guiTextObject.GetComponent<GUIText>(); 
    }

I also know how to just “Find” the object without the Tag, although I have read not to use it, and whether or not I should, I prefer to do it this way for tidiness and ease of expanding.

My problem is when I want multiples. I got my score text, so adding gameOver and restart, well my knowledge only gets me as far as copying and pasting:

    GameObject guiTextObject = GameObject.FindWithTag("Text"); 
    if (guiTextObject != null)
    { 
        scoreText = guiTextObject.GetComponent<GUIText>(); 
    }

    GameObject guiTextObject2 = GameObject.FindWithTag("Text"); 
    if (guiTextObject2 != null)
    { 
        restartText = guiTextObject.GetComponent<GUIText>(); 
    }

    GameObject guiTextObject3 = GameObject.FindWithTag("Text"); 
    if (guiTextObject3 != null)
    { 
        gameOverText = guiTextObject.GetComponent<GUIText>(); 
    }

Obviously I know this won’t work, since it doesn’t know which GUIText its aquiring in all items that are tagged with “Text” but this is the idea… So far I’ve managed to work out something that I think is close but not quite… Using arrays and for or foreach loops. Can someone please assist me:

    GameObject[] guitextobject = GameObject.FindGameObjectsWithTag("text"); 
    GUIText[] gui = new GUIText[guitextobject.Length];
    if (guitextobject != null)
    { 
        for (int i = 0; i < guitextobject.Length; i++)
        {
            guitextobject _= gui*.GetComponent<GUIText>();*_ 

}
}
Or something like:
GameObject[] objs ;
objs = GameObject.FindGameObjectsWithTag(“Text”);
GUIText[] gui = new GUIText[objs.Length];
foreach(GameObject gui in objs) {
objs = gui*.GetComponent();*
}
I know this is wrong because I can’t convert types or something, but I am at a programming wall basically I can’t figure out in my head all the terms and ways of doing stuff to get this to work. I must have the concept right? I want to make an array list, and make another array, put my text in the array, and set the game objects equal to the other array in the order of the first array…
EDIT: Okay so i managed to get it to compile. But although it compiles, it doesn’t help because it doesn’t do anything because I think I’m now stuck on how to assign the array values to my other GUIText update functions.
GameObject[] guiTextObject = GameObject.FindGameObjectsWithTag(“Text”);
GUIText[] gui = new GUIText[guiTextObject.Length];
if (guiTextObject != null)
{
for (int i = 0; i < guiTextObject.Length; i++)
{
gui = guiTextObject*.GetComponent();*
}
}
Here’s my variables
private GUIText scoreText;
private GUIText restartText;
private GUIText gameOverText;
private int score;
private bool restart;
private bool gameOver;
In my scene I have all 3 text objects in the area and in the scene they all say “text” (Obviously i don’t care what they say because I want to override that.)
So obviously what I had before worked fine on its own
GameObject guiTextObject = GameObject.FindWithTag(“Text”);
if (guiTextObject != null)
{
scoreText = guiTextObject.GetComponent();
}
Here’s my “UpdateScore()”
void UpdateScore() {
scoreText.text = "Score: " + score;
}
and my “GameOver()”
public void GameOver() {
gameOverText.text = “Game Over!”;
gameOver = true;
}
and my “Restart Text”
if (gameOver)
{
restartText.text = “press ‘R’ for Restart”;
restart = true;
break;
}
Okay so how do i actually get these variables
private GUIText scoreText;
private GUIText restartText;
private GUIText gameOverText;
Assigned to my new array? I honestly thought the script I was writing made it so the arrays matched… Like it searched tags “Text” and found 0 scoreText, 1 restartText, and 2 gameOverText, and then set a new array 0,1,2 to the GUIText… but now that I write that out it all stops making sense.
Am I even scripting the way I’m intending? Or is it compiling and just doing something that didn’t break the compiler, even though it isn’t something I’m trying to do?
I’m completely lost.
I need to figure this out because I don’t want to end up with 100 of these text objects and have to manually drag them all or update each individual “Find()” for every single one.

First of all, if you want to find all GUITexts in your scene you can use GUIText[] texts = FindObjectsOfType<GUIText>();
To fill your variables the only solution i see, is to use their names:

        for(int i = 0; i < texts.Length; ++i)
        {
            switch(texts*.name)*

{
case “ScoreText”: scoreText = texts*; break;*
case “GameOverText”: gameOverText = texts*; break;*

}
}
I hope this helps you.