Instantiating UI elements

I have a couple of UI canvases that have buttons (duh). These buttons are linked to code in scripts that players have. However, when I remove my player from the hierarchy, it unlinks the buttons with the functions. Yes, it is necessary to remove the player because it’s a multiplayer game where people can spawn in. Anyway, when I re-instantiate the player (with Photon Unity Networking), I can’t use the buttons. How can I link these buttons with the player as he/she spawns? I already tried instantiating the Canvases with the player, but then the canvases didn’t show up properly. Any ideas? Thanks!
(If need be, I can provide more detail.)

You can add delegates to a Button’s onClick event at runtime.

void SomeMethod()
{
   // do something
}

Button yourButton;
void OnInstantiate() // I don't know what the Photon instantiate method is called
{
    yourButton.onClick.AddListener(SomeMethod);
}