Photon Multiplayer - nick above model head, I have no idea how to repair it

Hello, my code:

	void OnGUI() {
		Vector3 offset = new Vector3(0, 3, 0);
		Vector3 point = Camera.main.WorldToScreenPoint(transform.position + offset);
		point.y = Screen.height - point.y;
		GUI.Label(new Rect(point.x - 35, point.y - 20, 200, 20), PhotonNetwork.playerName);
	}

This code show nickname above character. The problem is all characters have same name - the local players one. This happen because of “playerName” which show only local player name, not the others. So, is there any variable to fix it?

Secondly - how to modificate my code to show only team members? For example:

if(datPlayer == myTeamID)//my team
{
goAndShowHisNickname;
}
else
{
doNotShowIt;
}

Can I create code like that? Or it wouldn’t work in multi?

Adressing the first issue: PhotonNetwork.playerName returns the name of YOU, not of the game object the script is attached to. Instead you need to call GetComponent().name

Second Issue: You need to serialize what team the player is on using your OnPhotonSerializeView function in your script for your players. Compare your own player team’s id to the serialized team id of another player to check if you can display their name