title: I want my sphere to decrease the health of my player when my sphere is near my player in Unity
body: <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  
  public class HealthBarScript : MonoBehaviour
  {
    public Image HealthBar;
    public float CurrentHealth;
    public float MaxHealth = 100f;
    int Damage = 10;
    PlayerController_Script Player;
  
    private void Start()
    {
      HealthBar = GetComponent&lt;Image&gt;();
      CurrentHealth = 100f;
    }
    public void TakeDamage(int Damage)
    {
      CurrentHealth -= Damage;
      HealthBar.fillAmount = CurrentHealth/MaxHealth;
    }
  }
  </code></pre>
  <p>HealthBarScript: this is the script for my health bar UI. The health bar is a knob image with a filled image type. The method TakeDamage is supposed to be called whenever the 2nd script (AddDamage) calls it. Once the damage is taken, the health bar is supposed to decrease by 10, changing the amount filled in the filled image. This script is attached to the Image HealthBar.</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  
  public class AddDamage : MonoBehaviour
  {
    public float radius = 3;
    public int Damage = 10;
    public GameObject FPSController;
    public HealthBarScript HealthBarScript;
  
    void Start()
    {
    }
  
    void OnCollisionEnter(Collision col)
    {
      Collider[] colliders = Physics.OverlapSphere(transform.position, radius);
      foreach(Collider FPSController in colliders);
      {
        if(FPSController.tag == &quot;Player&quot;);
        {
          HealthBarScript.TakeDamage(Damage);
        }
      }
    }
  }
  </code></pre>
  <p>AddDamage: This is my collision script for when the collider of the sphere has the FPS controller within its surrounding radius, (The FPS controller is tagged Player), it will see the tag of the FPScontroller and call the TakeDamage method of the HealthBarScript. This script is attached to the Game Object sphere.</p>
  <p>The issue I am currently having is that although the health bar is supposed to decrease by 10 whenever the surrounding radius of the sphere has the FPS controller within it (AddDamage calls the TakeDamage method within the HealthBarScript whenever the FPS controller is within the collider array), nothing happens. There are no errors on the console.</p>