How can I stop killing myself ?

Hello,

The following script kills the wrong character.

	function OnTriggerEnter(collider : Collider)
	{
		if (collider.tag == "Default")
		{
			PhotonNetwork.Destroy(gameObject);
		}

		if (collider.tag == "Player")
		{
			PhotonNetwork.Destroy(gameObject);
			var player : Player = collider.GetComponent(Player);
			player.isDead = true;
		}
	}

How can I find a solution ?

Chances are that you are killing yourself because as you use a weapon or fire a bullet, it is in fact either spawning within the collider of the player firing(or whatever) and the tag is Player, you need to either add a condition so that the players own projectiles/weapons do not case damage or that the local player’s tag is renamed to say “LocalPlayer” instead of just player. This is only a guess though.

The script I published it about when you shoot a bullet on objects (Default) and on various players on multiplayer (Player).

All the players have the same tag.

I checked to see if the laser doesn’t shoot at the player himself, but not, otherwise the player will kill himself at every shot.

I also put the line “PhotonNetwork.Destroy(gameObject);” below “player.isDead = true;” but nothing change.

The player get killed everytime he shoot at another player.

It sounds like a problem with uisng the networking code. Might have more luck asking specifically about photonNetwork.

The lines player : Player = collider.GetComponent(Player); and player.isDead = true; are killing the local copy of what got hit. Not sure how photon works, but you generally have to tell the owner of the object (server? that player?) that they have been killed. For example, PhotonNetwork.Destroy(gameObject); is using the network to simul-kill all copies of the bullet.