i done this b4 but forgot :( touch screen

im sure all you know what this question is going to be lol, sorry for repeating. Anyone kind enuf to give a quick reminder as to why the code runs when touching anywhere on the screen? it shud run when i touch the gameobject with the collider==“Button”

function Update () 
{
    if( Input.touchCount > 0 )
    {
        var touch = Input.GetTouch(0);  // Cache touches for better performance
        var hit : RaycastHit;
        var ray = Camera.main.ScreenPointToRay( touch.position );

        // B E G A N
        if( touch.phase == TouchPhase.Began )
        {
            if( Physics.Raycast( ray, hit, 50 ) )   // If theres a hit
            {
                if( hit.collider.tag == "Button"  ) // If the hit is with button collider
                {
                    //be happy
                }
            }
        }
}

I did a little check up on your code, assuming your tagged object is a gameObject (which it should be) then this should work
I just broke up the act of finding the tagged object and the act of returning weather it has been hit or not for
elegance and hopefully to get the code working. let me know.

 function Update () 
    {
        if( Input.touchCount > 0 )
        {
         
            var touch = Input.GetTouch(0);  // Cache touches for better performance
            var hit : RaycastHit;
            var ray = Camera.main.ScreenPointToRay( touch.position );
    
            // B E G A N
            if( touch.phase == TouchPhase.Began )
            {
                if( Physics.Raycast( ray, hit, 100 ) )   // If theres a hit
                {
                    var obj1 : GameObject = GameObject.FindWithTag("Button"); // Break up the task of finding the button and hitting it in two
                    if( hit.transform == obj1.transform  ) // If the hit is with button collider
                    {
                        //be happy
                    }
                }
            }
    }

Using GameObject.FindWithTag is returning the first guy it finds, you could use FindGameObjectsWithTag, which will return a list of all objects with that tag:

var objects = GameObject.FindGameObjectsWithTag(“Button”);

then use

for (var object in objects)
{

if( hit.transform == object.transform  ){ // If the hit is with button collider

        //etc...
    }
    }