(Photon 2) How to delete a player permanently OnCollision

Hey everyone,

I am making a multiplayer game with Photon 2, and I want to make that when a specific object (Bullet to be exact) hits a player, that particular player completely gets destroyed and has to respawn on the default spawn location to play again, and it is not working when I kill the other player from my game, the object does get deleted but only from my POV, the object still exists and it is moveable when I switch to his game

Can somebody please explain to me how I can fix it, even if the player gets destroyed from his POV and my POV instead of respawning, no problem, I can continue with that

void OnCollisionEnter ( Collision collision)
{
    if( collision.collider.CompareTag("Player") )
    {
        Destroy( collision.gameObject );
        PhotonNetwork.Destroy( collision.gameObject );
    }
}

I’m not a pro at photon by any means but maybe try having the bullet be detected by the player as well as by the bullet. Ie put the same code into your players collider but with the tag “Bullet” instead of “Player”.

It might not be the best advice but its what I would think to do.

Hi man,

Multiplayer games are different form normal Unity games. When you destroy this player… you do this only on your client game… instead this should be done from server side…

Not working for some time with multiplayer (hate it) but you need to do some research on NetworkSync.

So when you killed player, you send request to server, server approves it and spread info to clients…

If you will continue building game like in normal project, server will not be aware of changes, and will not distribute info to client’s.

You need to do some research on topics like ClientRPC, ServerCMD before you will continue. There is lots of tutorials on youtube.

https://www.youtube.com/results?search_query=unity+photon+tutorial

Hope that helped!