Photon Int sync not working

I feel very stupid for asking this but I’ve turned despite. So im trying to get a int to show how many people escaped something. Whenever a player collides with the escape place it shows up you escaped and "int + out of 4 people escaped. But it won’t sync the int. By the way im using photon Pun 2. Here is the script.`public class c : MonoBehaviour, Photon.Pun.IPunObservable {
public Text text;
private int escaped;
public PhotonView photonView;

void Start () {
  
    
    
}
public void OnCollisionEnter(Collision collision)
{
    if (collision.gameObject.name == "bobbobbob(Clone)")
    {

        escaped++;
    }
}
// Update is called once per frame
void Update()
{
    text.text = escaped + " out of 4 escaped alive";

    
}

public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
    if (stream.IsWriting)
    {
        stream.SendNext(escaped);

    }

    if (stream.IsReading)
    {
        escaped = (int)stream.ReceiveNext();
    }
   
}`

Yo,

this is the same problem as in your last 2 questions…
Please learn 2 things:

1: Do not sync things that do not change every frame by using the stream! Use an RPC for that. This will also solve your problem on it’s own when you change to using an rpc.

2: When you use the stream. There will be one “true” variable that everyone else will follow…
When A owns the “escape” thing then only the collision on player A’s instance will do anything.
For some player B,C,… they will change the variable and then recieve the synchronized value form player A who owns the object and overwrite the value.

Think about ownership of object instances. Let me know if something was unclear, you basically had this same problem the third time now. Look into this question you posted. Its exaclty the same issue.

Hey,

First I just want to say sorry for asking a lot of questions. Second, before I asked this question, I used a RPC but it didn’t work here is the script where I used the RPC.

I double checked everything but it still said 0 thats why I went back to using the stream.