OnSerializeNetworkView problems with clients

Hello everyone.

Its the first time i use this function and i have a little problem with it.
i want to display the health/maxhealth if the player aims at another player.

At the moment if there is only 1 client connected to the server all runs well but if a second client is connected all players have the health/maxhealth from the server displayed.

function OnSerializeNetworkView(stream : BitStream, info : NetworkMessageInfo) 
{
	health = PlayerPrefs.GetInt("Health");
   	maxhealth = PlayerPrefs.GetInt("Max Health");	
	if (stream.isWriting) 
	{
    	stream.Serialize(health);
    	stream.Serialize(maxhealth);
    } 
    else 
    {
   		stream.Serialize(health);
   		stream.Serialize(maxhealth);
    }
}

And this is are the lines to change the value for the display

healthText = hit.transform.GetComponent(PlayerLocalVars).health;
maxhealthText = hit.transform.GetComponent(PlayerLocalVars).maxhealth;

Some info:

The script “PlayerLocalVars” is attached to the player.
The script “PlayerLocalVars” got the Network View component.
The server is a player aswell.

Problem solved!

i got rid of the OnSerializeNetworkView and used an RPC call.

everytime the health change (regeneration or damage by npcs) i call this RPC

networkView.RPC("SetHealth", RPCMode.AllBuffered, PlayerPrefs.GetInt("Health"), PlayerPrefs.GetInt("Max Health"), gameObject.networkView.viewID);

and the function does this

@RPC
function SetHealth(playerHealth : int, playerMaxHealth : int, viewID : NetworkViewID)
{
	health = playerHealth;
	maxhealth = playerMaxHealth;
}

now it doesnt matter if you are server or client… the health/maxhealth gets displayed correcty for each client and server.