Reducing float from other script.

Hi! I have 2 scripts, basically a score giver and an upgrade script.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SocialPlatforms.Impl;

public class GrassvalueScript : MonoBehaviour
{


    public float amount;
    public float upgradeAmount = 0;
    public float requiered = 100;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        amount = GameObject.FindWithTag("cutter").GetComponent<tool>().totalAmount;

    }

    public void OnClick()
    {
        if (amount >= requiered)
        {
            amount = amount - requiered;
            upgradeAmount = upgradeAmount + 1;
            requiered = requiered * 2.5f;
            print("bought");
            print(upgradeAmount);
        }

        else
        {
            print("not enough");
        }
    }
}

ยจ

Script that I am trying to change the float in.

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class tool : MonoBehaviour
{



    private SpriteRenderer sprite;
    private BoxCollider2D bcollider;
    public float timer = 0f;
    public float GrowTime = 20.0f;
    public float maxSize = 1f;

    public float score = 1;
    public TextMeshProUGUI scoretext;
    private GameObject grass;
    public float totalAmount;




    public bool isMaxSize = false;
    // Start is called before the first frame update
    void Start()
    {



    }

    // Update is called once per frame
    void Update()
    {

    }

    private void FixedUpdate()
    {
        UpdateScore();
    }

    private IEnumerator Grow()
    {
        Vector2 startScale = grass.transform.localScale;
        Vector2 maxScale = new Vector2(maxSize, maxSize);

        do
        {
            grass.transform.localScale = Vector3.Lerp(startScale, maxScale, timer / GrowTime);
            timer += Time.deltaTime;
            yield return null;
        }
        while (timer < GrowTime);

        isMaxSize = true;
    }




    public void cooldown()
    {
        grass.GetComponent<BoxCollider2D>().enabled = true;
    }


    public void AddScore(int newScore)
    {
        score += newScore - 1;
    }
    public void UpdateScore()
    {
        scoretext.text = "" + totalAmount;
    }
    public void grassrepsawn()
    {

        grass.GetComponent<SpriteRenderer>().enabled = true;
        timer = 0f;
        StartCoroutine(Grow());
        Invoke(nameof(cooldown), 20f);




    }


    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "grass")
        {
            totalAmount = totalAmount + score;
            print("grasscutted");
            grass = collision.gameObject;
            collision.gameObject.GetComponent<BoxCollider2D>().enabled = false;

            collision.gameObject.GetComponent<SpriteRenderer>().enabled = false;

            collision.gameObject.transform.localScale = new Vector3(0.001f, 0.001f, 0.001f);



            if (!grass.GetComponent<GrassGrow>())
            {
                grass.AddComponent<GrassGrow>();
            }




            isMaxSize = false;



        }
    }


}

Script where the float is.

My problem is that when the player buys an upgrade, I want the the cost of the upgrade to be reduced from the total score the player has.
But when I gather enough points and buy the upgrade, the total score doesn't decrease.
This question has probably been asked many times, but I just can't seem to find a solution to my problem.
Can anyone help?

using UnityEngine;
public class GrassvalueScript : MonoBehaviour
{
    public float upgradeAmount = 0;
    public float required = 100;
    public tool myTool;        // holds a refrence to the tool component/script

    void Start()
    {
        myTool=GameObject.FindWithTag("cutter").GetComponent<tool>(); // Ideally you should remove this line and manually drag the tool onto the myTool reference above, using the Inspector
    }

    public void OnClick()
    {
        if (myTool.totalAmount >= required)
        {
            myTool.totalAmount -= required;
            upgradeAmount += 1;
            required *= 2.5f;
            print("bought");
            print(upgradeAmount);
        }
        else
        {
            print("not enough");
        }
    }
}

It worked thank you!