Multiplayer Death to Player

Hello all,

I have a small issue with death script i have in my multiplayer project… when Player-A kills Player-B, when the Death Animation happens, and Player-B is on the Ground DEAD for 5 seconds or less before respawn, if Player-A continues to Attack Player-B while DEAD, Player-B’s Character rises up from the ground and shows the Getting Hit / Taking Damage Animation and continues to get HIT… but he is DEAD LOL!! so how can I stop the Damage / Taking Hit Function when a Player is DEAD?

here is my Death Code, Note: I am using Photon Cloud for Networking

	[RPC]
	IEnumerator respawnFunc (int selectedSpawn) {
		
		isDeath = true;
		life = 100;
		yield return new WaitForSeconds(5);
		renderer.enabled = false;
		transform.position = spawnPoints[selectedSpawn].transform.position;
		yield return new WaitForSeconds(1.0f);
		renderer.enabled = true;
		isDeath = false;

	}

anything I can insert in here that will stop the Taking Damage Function?

in your code, you can see something like

isDeath = true;

find part of the code where damage is applied to the player and wrap it so it looks like

if (!isDeath ) {
      // code where you apply damage to player...
}

:p:p:p