RPC not executed by every player?

Hi guys, i cant realize what is wrong. I’m already using RPC for lots of things but really i dont know why i cant get working this one with every player that is connected to the room . When this is executed it will give results only on the executing client and not also at the others, here is the code :

//Checking Collisions with Bullets
    void OnCollisionEnter(Collision col){
        if (col.gameObject.tag == "Bullet") {
            Debug.Log ("Took Damage");
            if(photonView.isMine)
                takeDamage(col.gameObject.name);
        }
    }

//Handling damage
    void takeDamage(string shooter){
        health -= damage;
        if (health <= 0) {
            photonView.RPC("SetKillBoxText",PhotonTargets.All,PhotonNetwork.player.name,shooter);
            anim.SetBool("Die",true);
        }
    }

    [RPC]
    public void SetKillBoxText(string killed,string killer){
        killText.text = killed + " was killed by " + killer;
    }

so if player A dies by player B Bullets, only player A will get the text " A was killed by B" …
the killtext is just a text object put on playerUI
why O_O?

Seems alright. Do you by any chance disable or respawn the player after he died or something like that?

1 Like

Found the bug : i mistakenly misunderstood the RPC functions → they will work ONLY in the current object…like you said i disabled this script somewhere during the game but now it’s solved…

thanks as always for the help!