ArgumentException: Index out of bounds. Help?

Current script, I am trying to add a touch feature to add money.

public class AddReducePlayerMoney : MonoBehaviour
{
    public int money;
    public GameObject cam;

    void Update()
    {
        Touch myTouch = Input.GetTouch(1);
        

        Touch[] myTouches = Input.touches;
        for(int i = 1; i < Input.touchCount; i++)
        {
            if (Input.GetButtonDown("Fire1"))
            {
                cam.GetComponent<PlayerMoney>().addMoney(5);
            }

            if (Input.GetButtonDown("Fire2"))
            {
                cam.GetComponent<PlayerMoney>().subtractMoney(5);
            }
        }
    }
}

hi;
by “Input.GetTouch(1)” u mean that u want to get the second touch of the player;
if u want to get the first one u should use Input.GetTouch(0) "

but the problem with your error is you are not checking if there is any touch in the game or not so first of all u should add this checking to your update method;

 if ( Input.touchCount > 0)