Falldamage has no effect on my HB

The Falldamage has no effect on my healthBar when I collide from a distance of 20. here’s the script:

Ray GroundedTestRay; 
RayCastHit Ground; 
RayCastHit PlayerHit; 
bool Grounded;

    GroundedTestRay.origin = player.transform.position;
    GroundedTestRay.direction = -player.transform.up // negative up so down dont forget -
     
    physics.raycast(Ray, out Ground);
     
    GroundedTestRay.origin = Ground.point + (-player.transform.up * .1); //start just under the ground to make sure there isn't any errors from beign so close
     
    GroundedTestRay.direction = player.transform.position - Ground.point; //cast toward player
     
    physics.raycast(GroundedTestRay, out PlayerHit);
     
    if (vector3.distance (Ground.point, PlayerHit.point) > .1)
    {
    Grounded = false;
    ApplyDamage = true;
    }
     
     
    float Timer;
    bool TimerEnable;
    bool ApplyDamage;
    void Update()
    {
    if(TimerEnable)
    {
    Timer += time.deltatime;
    }
    If(!TimerEnable)
    {
    Timer = 0;
    }
    void FixedUpdate()
    {
    if (!Grounded)
    {
    TimerEnable = true;
    }
    if( Grounded)
    {
    TimerEnable = false;
    }
     
    if(Grounded && ApplyDamage)
    {
    if(timer > MinimumTimeToTakeDamage)
    {
    Damage = (PlayerHealthBar)target.GetComponent("PlayerHealthBar");
		eh.AddjustCurrentHealth(-100);
    }
    }
    }

It doen’st work.

You have an if statement is your Falldamage class without an else.

Try the following code

private void OnTriggerEnter(Collider other) { 
	if(other.tag == "player") { 
		float distance = Vector3.Distance(target.transform.position, transform.position); 
		if(distance < 20) { 
			PlayerHealthBar eh = (PlayerHealthBar)target.GetComponent("PlayerHealthBar"); 
			eh.AddjustCurrentHealth(-100); 
		}
		else {
			PlayerHealthBar eh = (PlayerHealthBar)target.GetComponent("PlayerHealthBar"); 
			eh.AddjustCurrentHealth(-200); 
		}
	} 
}

A. Distance of 20 is really high first off just to note, it’s not the problem but it should be noted that unity uses meters and so 60 feet is not just enough to damage it’s enough to kill you.

by the time you collide the distance between the ground and the player is less than 20 so doing a distance check doesnt work.

basically what you actually need to do is during fixed update do a check to see if your grounded if not start a timer.

once you become grounded if the timer is greater than something (you could use the formula for gravity if you want to use distance)
so for example

distance = time / 60 (assuming 60 frames per second and updated using fixed update you could use other methods, regardless get the value in seconds) * 9.81;

so if you have fallen for 1 second you have fallen 9.81 or something like 30 feet

then basically do if distance > fall distance take damage.