private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("PickUp")) { other.gameObject.SetActive(false); Rigidbody targetRigidbody = GetComponent <Rigidbody>(); TankHealth targetHealth = targetRigidbody.GetComponent <TankHealth>(); float heal = 30f; targetHealth.TakeHeal(heal); } }