C#: Float not increasing and not reflecting to UI bar thingy

ok so I have no idea what to call this.

Anywho so my problem is the following. I have this UI bar set up and it is working as a Exp bar. The problem is it is not reflecting my current experience and with that my current experience is not getting increased when I kill an enemy.

Le bar script:

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

public class ExpBarScript : MonoBehaviour {

    public float fillAmount;
    public Experience experience;
    public Image EXPContent;


    // Use this for initialization
    void Start () {
       
    }
   
    // Update is called once per frame
    void Update () {
        ExpHandleBar();
    }

    private void ExpHandleBar(){
        EXPContent.fillAmount = Map(experience.currentExp,0,experience.expNeeded,0,1);
        //(currenthealth,Minhealth,maxhealth,0,0)
    }

    private float Map(float value, float inMin, float inMax, float outMin, float outMax){
        return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
        //(80 - 0) * (1 - 0) / (100 - 0) + 0
    }
}

Le Experience script:

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

public class Experience : MonoBehaviour {

    public int playerLevel = 1;
    public float expLevelModifier = 1.5f;
    public float expNeeded = 100f;
    public float currentExp = 0f;
    //public Image level1;

    public PlayerHealth player;


    // Use this for initialization
    void Start () {
       
    }
   
    // Update is called once per frame
    void Update () {
        if(currentExp >= expNeeded){
            currentExp = 0f;
            playerLevel += 1;
            expNeeded = (expNeeded * expLevelModifier);
            player.maxHealth = (player.maxHealth * player.healthModifier);
            Debug.Log("Level Up");
        }
    }
}

and the only other thing that changes the current exp value is my enemy script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//
public class EnemyDamageHandler : MonoBehaviour {

    public float enemyHealth = 1f;
    public float zombieDamage = 10f;
    public float experienceGain;
    public BulletDamageHandler bDamage;
    public ShellDamageHandler sDamage;
    public Experience experience;
    
    void OnTriggerEnter2D(Collider2D other){
        //Debug.Log ("Enemy Hit!");
        if(other.gameObject.tag == "Bullet"){
            enemyHealth -= bDamage.bulletDamage;
        }else if (other.gameObject.tag == "Shell"){
            enemyHealth -= sDamage.shellDamage;
        }


        if(enemyHealth <= 0){
            experience.currentExp += experienceGain;
            Die();
        }
    }

    void Die(){
        Destroy(gameObject);
    }
}

Though it only does anything when the enemy dies which is here:

if(enemyHealth <= 0){
            experience.currentExp += experienceGain;
            Die();
        }

So for starters I have the exact same script set up for my health bar and it is working just fine. But for some strange reason my bar simply refuses to move to my current experience and my current experience is refusing to increase when an enemy is killed. I honestly don’t see a problem with the script and it isn’t giving any errors when the enemy dies so I assume the exp gain went through.

The bar always show full so I assume it is not finding the current value of my current exp. That or something is getting in the way.

Any help would be kindly appreciated.

I am confused why you’re doing exphandlebar in an update instead of just when something dies or you gain exp. This would also be true about your update to check for level up.

As far as assuming, I would double check to make sure that all values are as expected with some prints or debugs.

Also, are all these scripts on the same gameobject, different gameobjects?

Bah i found the problem. My experience script is applied to an empty game object in the scene and I created a prefab of that object so that I can add it to my enemies. Now the reason why my bar shows full is because the prefab saves the experience gained and does not reset it and thus my bar is always full unless I restart or manually change it back. So I will need to find a way to access the script without it being attached to a game object.