solution to my problem . need your experience in unet

hi . i create a 1 v 1 online game . in that game there is a button that score up the player (button is in ui canvas not in player prefab) . here is the code :

public void ClickMe() {
   GameObject Player = GameObject.FindGameObjectWithTag ("Player");
   if (Player != null) {
      Score score = Player.GetComponent<Score> ();
      score.ScoreUP (10);
   }
}

the “Player” tag set in OnStartLocalPlayer function in my playercontroller.cs file on player prefab :

public override void OnStartLocalPlayer() {
   this.transform.tag = "Player";
}

for some reason i cant use OnStartLocalPlayer function !

how can i run ScoreUP function in ClickMe button only on who click it ?

i solve it !

public void ClickMe() {
	GameObject[] Ps = GameObject.FindGameObjectsWithTag ("Player");
	Players.AddRange (Ps);
	for (int i = 0; i < Players.Count; i++) {
		MyPlayerController PC = Players *.GetComponent<MyPlayerController> ();*
  •  if (PC.hasAuthority) {*
    

_ Score score = Players .GetComponent ();_
* score.ScoreUP (10);*
* }*
* }*
}
this is the code in my button . all player prefabs (i just have 2) have “Player” tag !