Photon Multiplayer Sync

Hi everyone, hope u all have a great summer!

I have a problem with Photon Syncing.

I have this gameobject which is a door that i need to do so everyone can open and close but only the host can open the door and the connected players can see it half open and like going back and forward in the swing, what causes this?

I have a photon transform and photon view on which u can see in the images
I have also attached a image with the code, but u can also see the code for the door below
(Players interact with the door with a interact script which is on the players camera)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;

public class Door : MonoBehaviour {

   
   
    [SerializeField] public bool DoorOpen = false;
    [SerializeField] public int DefaultRotation = 0;

    [SerializeField] public bool Locked = false;


    public enum State
    {
        left,right
    }
   
    [SerializeField]
    public State rotate;
    [SerializeField]
    private int RotateVal;

   
   
    private void Start()
    {
        if (rotate == State.left)
            RotateVal = -90;
        else
            RotateVal = 90;
    }


    void Update()
    {
        if (DoorOpen)
        {
            Quaternion newRotation = Quaternion.AngleAxis(RotateVal, Vector3.up);
            transform.rotation = Quaternion.Slerp(transform.rotation, newRotation, 0.1f);
        }
        else
        {
            Quaternion newRotation = Quaternion.AngleAxis(0, Vector3.up);
            transform.rotation = Quaternion.Slerp(transform.rotation, newRotation, 0.1f);
        }
    }


    public void OpenDoor()
    {
        Debug.Log("Opening door");
        if (Locked == false)
        {
            if (DoorOpen)
            {
                DoorOpen = false;
                Debug.Log("1");
            }
            else
            {
                DoorOpen = true;
                Debug.Log("2");
            }
        }
    }
}



I wouldn’t use a PhotonView and PhotonTransform on the doors.

So, assuming the door is part of the scene and not network instantiated. My approach would be to add a script to the door that listens to network events, and then use RaiseEvent to send an ‘open/close door’ event to all clients.

When the network event listener script receives the event it can call the function on the door to open/close it. You’ll want to give all objects that listen for this event a unique ID, and send that ID in the event data so that you can make sure you open/close the correct door.