Anyway to make oncollision damage is done which will remove health?

I am looking for a way where on2dcollision health is removed, similar to that of diep.io any references or personal solutions would be very appreciated. Thanks.

GM Script:

using UnityEngine;
using System.Collections;
using UnityStandardAssets.ImageEffects;

public class GameMaster : MonoBehaviour {

	public static GameMaster gm;

	void Awake () {
		if (gm == null) {
			gm = GameObject.FindGameObjectWithTag ("GM").GetComponent<GameMaster>();
		}
	}

	public Transform playerPrefab;
	public Transform spawnPoint;
	public float spawnDelay = 2;
	public Transform spawnPrefab;

	public IEnumerator RespawnPlayer () {
		GetComponent<AudioSource>().Play ();
		yield return new WaitForSeconds (spawnDelay);

		Instantiate (playerPrefab, spawnPoint.position, spawnPoint.rotation);
		GameObject clone = Instantiate (spawnPrefab, spawnPoint.position, spawnPoint.rotation) as GameObject;
		Destroy (clone, 3f);
	}

	public static void KillPlayer (Player player) {
		Destroy (player.gameObject);
		gm.StartCoroutine (gm.RespawnPlayer());
	}
	
	public static void KillEnemy (Enemy enemy) {
		Destroy (enemy.gameObject);
	}

}

Player/Enemy Script:

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

	[System.Serializable]
	public class PlayerStats {
		public int Health = 100;
	}

	public PlayerStats playerStats = new PlayerStats();

	public int fallBoundary = -20;

	void Update () {
		if (transform.position.y <= fallBoundary)
			DamagePlayer (9999999);
	}

	public void DamagePlayer (int damage) {
		playerStats.Health -= damage;
		if (playerStats.Health <= 0) {
			GameMaster.KillPlayer(this);
		}
	}

}

If I understand correctly, you want to know how to detect collisions. If so, this code may help:

int EnemyDamage = 1;

void OnCollisionEnter2D(Collision2D)
{
   Health -= EnemyDamage;
}

Of course, this is just a rough layout, so you may have to do some tinkering.
More information about collisions and other features can be found in the Unity Manual.

https://docs.unity3d.com/ScriptReference/Collision.html