How to get player's name when player click button

Hi! I’m making to multiplayer game using Mirror. In the scene player can choose characters by clicking the buttons. But I know to how to tell unity which player is clicking on that button. How to get player’s name who click the button?

I added if (isLocalPlayer) still not work

 public void BeomeThisCharacter(int num)
    {
        if (isLocalPlayer)
        {
            character.GetComponent<SpriteRenderer>().sprite = characterChoice[num];
            character.AddComponent<Animator>();
            character.GetComponent<Animator>().runtimeAnimatorController = animeControl[num];
        }
    }