How do I make enemies deal damage to the player?

So I’m making an fps where whenever an enemy collides with the player, the player takes damage, but nothing I do seems to work. A little help would be greatly appreciated.
Enemy damage script:

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

public class EnemyDamage : MonoBehaviour
{
public float damageAmount = 1;
public bool FindPlayer;

void GiveDamage()
{
    if (FindPlayer)
    {
        if (GameObject.FindGameObjectWithTag("Player"))
        {
            GetComponent<PlayerHealth>().TakeDamage();
        }
    }
}

private void OnTriggerEnter(Collider collision)
{
    FindPlayer = true;
}

}

Player health script:

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

public class PlayerHealth : MonoBehaviour
{
public int Health = 100;

public void TakeDamage(int amount)
{
    Health -= amount;
}

public void OnCollisionEnter(Collision hit)
{
    if (hit.gameObject.CompareTag("Enemy"))
    {
        GetComponent<EnemyDamage> damageAmount;

        TakeDamage();
    }
}

}

Hi @unity_25georgedk The if statement which checks for the player game object isn’t using its return as the source of the GetComponent call, but instead only as a true test. The code will need to use the returned object from the Find call as the source of the GetComponent call. As it works right now, the GetComponent is calling from the same object as the GiveDamage method, which I assume does not contain the player health component.

As an aside, the logic here is a little off-the-mark. Rather than having the OnTriggerEnter toggle a find player parameter, do the logic for the player within the OnTriggerEnter method, and use the passed collider as the source object. Given that the code is using triggers, I assume the player has a rigidbody. I’ll also assume the player health component is on the same object as the rigid body (even if nested):<pre>private void OnTriggerEnter(Collider collider) { if(collider.attachedRigidbody == null) { return; } // not the player since its missing the rigid body if(collider.attachedRigidbody.tag != "Player") { return; } // not the player since the tag is wrong PlayerHealth playerHealth = collider.attachedRigidbody.GetComponentInChildren<PlayerHealth>(); if(playerHealth == null) { return; } // not the player since it has no player health component playerHealth.TakeDamage(); }</pre>