title: How to make script work for all players Unity Photon?
body: <blockquote>
    <p>I want all players to be able to move and throw gameObjects in the scene
    with this script:</p>
  </blockquote>
  
  <pre><code> [RequireComponent( typeof( PhotonView ) )]
   public class PickupObjectNetwork : Photon.MonoBehaviour {
   public GameObject mainCamera;    
   public bool carrying;
   GameObject carriedObject;
   public float distance;
   public float smooth;
   public float throwPower = 10f;
   private float chargeTime = 0f;    
   // Use this for initialization
   void Start () {
       mainCamera = GameObject.FindWithTag("MainCamera");            
   }
   // Update is called once per frame
   void Update () {
       if(photonView.isMine)
       {            
           if(carriedObject == null)
           {
               carrying = false;
           }
           if(gameObject == null)
               return;
  
           if(carrying) {
               photonView.RPC("carry", PhotonTargets.AllBuffered);
               photonView.RPC("checkDrop", PhotonTargets.AllBuffered);
  
               if (Input.GetMouseButtonUp (0)) {
                   float pushForce = chargeTime * 10;
                   pushForce = Mathf.Clamp (pushForce, 1, 20);
                   photonView.RPC("throwObject", PhotonTargets.AllBuffered, pushForce);
                   chargeTime = 0;
               }                
           } else {
               if(Input.GetKeyDown (KeyCode.E)) {                    
                   photonView.RPC("pickup", PhotonTargets.AllBuffered);
               }
           }
           if(Input.GetMouseButton(0)){
               chargeTime += Time.deltaTime;
           }
       }
   }
   [PunRPC]
   void carry() {            
       if (carriedObject == null)
       {
           return;
       }        
       Debug.Log("picked up object with id: " + carriedObject.GetComponent&lt;PhotonView&gt;().viewID);
       carriedObject.transform.position = Vector3.Lerp (carriedObject.transform.position, mainCamera.transform.position + mainCamera.transform.forward * distance, Time.deltaTime * smooth);
       carriedObject.transform.rotation = Quaternion.identity;
   }
   [PunRPC]
   void pickup() {                
           int x = Screen.width / 2;
           int y = Screen.height / 2;
           Ray ray = mainCamera.GetComponent&lt;Camera&gt;().ScreenPointToRay(new Vector3(x,y));
           RaycastHit hit;
           if(Physics.Raycast(ray, out hit)) {
               Pickupable p = hit.collider.GetComponent&lt;Pickupable&gt;();
               if(p != null &amp;&amp; hit.distance &lt; 5) {
                   carrying = true;
                   carriedObject = p.gameObject;                                
                   p.gameObject.GetComponent&lt;Rigidbody&gt;().velocity = Vector3.zero;
                   p.gameObject.GetComponent&lt;Rigidbody&gt;().useGravity = false;                            
               }
           }        
   }
   [PunRPC]
   void checkDrop() {            
       if(Input.GetKeyDown (KeyCode.E)) {
           dropObject();
       }
   }
   [PunRPC]
   void dropObject() {        
       carrying = false;        
       carriedObject.gameObject.GetComponent&lt;Rigidbody&gt;().useGravity = true;
       carriedObject = null;
   }
   [PunRPC]
   void throwObject(float pushForce){            
       carrying = false;
       if(carriedObject.tag != "BoxMultiplayer")
           carriedObject.tag = "Projectile";
       carriedObject.GetComponent&lt;Rigidbody&gt; ().AddForce(Camera.main.transform.forward * pushForce * 200);
       carriedObject.gameObject.GetComponent&lt;Rigidbody&gt; ().useGravity = true;            
       carriedObject = null;
   }    
   }
  </code></pre>
  
  <blockquote>
    <p>I instantiate scene objects using
    PhotonNetwork.InstantiateSceneObject(); This script works only for
    master client, non-master clients can not move objects.</p>
    
    <p>I also tried this script (randomly): <a href="http://pastebin.com/7DgjZ9U7" rel="nofollow noreferrer">http://pastebin.com/7DgjZ9U7</a>
    I don`t really know how to work with AllocateViewId(). When i use this
    script, both players can move sceneObjects, but object movement is not
    synchronized (object positions are not updating for other players).
    Also, when one of the players throws gameObject into
    the wall, which destroys new collisions with PhotonNetwork.Destroy(),
    this player freezes in place for others. 
    Hope that my question is not super messy. Thanks in advance!</p>
  </blockquote>