Can't get tagged objects to change material

I am trying to change the material on multiple objects by pressing a button. Unfortunately I have only succeeded in making one object change material. I’m sure its something simple, but I just can’t see it. Here’s my current script. Any help would be appreciated.

#pragma strict
     
     
     var materialchange1 : Material;
     
     function Update () {
         if (Input.GetButtonUp("mat")) {
              GameObject.FindGameObjectWithTag("score").GetComponent(Renderer).material = materialchange1;
         }
     }

Go to button on click event and drag the object of which you want to change the material and choose MershRenderer.SharedMaterial then add the material there u want to add. You can do it like that simple.

Umm, FindObjectWithTag does exactly as it says “Find Object” a single object. It will stop searching after that. What you want is this…

GameObject[] objs = FindObjectsWithTag("score");
foreach (GameObject obj in objs)
{
    Renderer r = obj.GetComponent<Renderer>();
    if (r)
    {
        r.material = materialchange1 ;
    }
}

Sorry it’s in C#, but that should be easy to fix.