Network Raycast

Hi everybody.
I am trying to get some code to work over the network.
The idea is that this code should work regardless of who does it. But it only works on the server. When I chance the RPCMode to Server it only works on the client,so that didn’t work also.

private var hitObjectPosition : Vector3;
private var hitObjectRotation : Quaternion;

//Set communication with gameplay code to know how many players are available.
private var gamePlay;
gamePlay = GetComponent(NetworkGamePlay);

private var ray;
private var hits : RaycastHit[];
private var objectRenderer;

function Update () 
{
	if (Input.GetMouseButtonDown(0))
	{
		//Transform the mouse position on screen to a position in 3d enviroment.
		ray = Camera.main.ScreenPointToRay (Input.mousePosition);
		networkView.RPC("ChangeColor", RPCMode.All);
	}
}

@RPC
function ChangeColor ()
{	
	hits = Physics.RaycastAll (ray, 100.0);
	
	// Change the material of all hit colliders
	for (var i=0;i<hits.length;i++)
	{
		var hit : RaycastHit = hits[i];
		objectRenderer = hit.collider.renderer;
		if (objectRenderer)
		{
			//objectRenderer.material.shader = Shader.Find("Transparent/Diffuse");
			objectRenderer.material.color = gamePlay.playerColors[gamePlay.playerTurn];
			hitObjectPosition = hit.transform.position;
			hitObjectRotation = hit.transform.rotation;
			Destroy (hit.collider);
		}
	}
	
	if (hits.length == 0)
	{
		hitObjectPosition = Vector3(0.0,0.0,0.0);
	}
}

I have this code here:

@RPC
function GetPos ()
{	
	ray = Camera.main.ScreenPointToRay (Input.mousePosition);
	hits = Physics.RaycastAll (ray, 100.0);
	// Change the material of all hit colliders
	for (var i=0;i<hits.length;i++)
	{
		var hit : RaycastHit = hits[i];
		objectRenderer = hit.transform.renderer;
		if (objectRenderer)
		{
			//objectRenderer.material.shader = Shader.Find("Transparent/Diffuse");
			//objectRenderer.material.color = gamePlay.playerColors[gamePlay.playerTurn];
			hitObjectPosition = hit.transform.position;
			hitObjectRotation = hit.transform.rotation;
			Destroy (hit.collider);
		}
	}
	
	if (hits.length == 0)
	{
		hitObjectPosition = Vector3(0.0,0.0,0.0);
	}
}

I call it like this:

networkView.RPC("GetPos", RPCMode.All);

But it only works on the server side. Why is that? Any pointer would be very much appreciated!

Edit:

ray = Camera.main.ScreenPointToRay (Input.mousePosition);
		networkView.RPC("GetPos", RPCMode.All);

Now I am calling it like this and removed the extra line from the above script. Like this I was hoping the ray position would be invoked from the machine the click was made on. But it isn’t. It still uses the mouse position from the server :frowning: