Object does not follow player on other clients when player picks it up

Im creating an FPS game. If theres a gun on the floor and a player picks it up, other players do not see the gun follow that player, Instead, the gun goes to position 0,0,0 and stays there until the player drops the gun.

The gun of course has a Photon view and transform etc

Here is the snippet script that tells the gun to become a child of the player. Ive noticed when I pick up a gun , it does not become a child of the player on the other client, so I need someone to tell the client that I have picked it up and it should follow my player. I have no idea how to do this and ive done some research on RPCs but with no luck


The script has use photon.pun and also a GetComponent<PhotonView>();


All help appreciated

public Transform GunInView;

public GameObject GunHoldLocation; // GunHoldLocation is a empty gameobject where the gun sits when it is held


GunInView = hit.transform; // hit is a raycast name

if (Input.GetKey(KeyCode.E))

{

GunInView.SetParent(GunHoldLocation.transform);

GunInView.position = GunHoldLocation.transform.position;

GunInView.transform.rotation = GunHoldLocation.transform.rotation;