Hey i have this script that makes damage(to our player) every time a falling enemy falls and collide to our player, but i also wanna make damage to our player if the enemy falls (collide) with the floor. How can i do it?

Hey i have this script that makes damage(to our player) every time a falling enemy falls and collide to our player, but i also wanna make damage to our player if the enemy falls (collide) with the floor. How can i do it?

You can make the floor have a tag (called “Floor”), then just use that tag like :
if (collisiongameObject.tag == "Floor")
{
health Playerhealth = GameObject.FindGameObjectWithTag("Player").GetComponent<health>();
Playerhealth.TakeDamage(Enemydamage);
}
EDIT : All the issues in the script are fixed