How do i kick players with photon

Im using

  • [PunRPC]
  • private void KickPlayer()
  • {
  • PhotonNetwork.LeaveRoom(); // load lobby scene, returns to master server
  • }
    • public void SendKickPlayer(int playerID)
  • {
  • PhotonPlayer player = PhotonPlayer.Find(playerID);
    • photonView.RPC(“KickPlayer”,player);
  • }

but for some reson PhotonPlayer script doesnt exit so i have to use Player instead but when i do it says that “Find” dosent exist in the script.
sorry for the bad english

Hi @julianrota0

This question appears to be for Photon Multiplayer which is unrelated to Unity’s Lobby service. Let me know if you posted here in your usage of a Unity sample and I can try to assist with any issues you may be encountering. If you need help with Photon, you will need to reach out to the developer for further assistance.

With that said, it sounds like the error you’re running into is that the PhotonPlayer script doesn’t exist. I believe this may be happening because the PhotonPlayer class is deprecated in PUN2 and was renamed to just Player. However, Player is likely to be an overloaded term and you may need to specify the namespace with something like:

public void SendKickPlayer(int playerID)
{
  Photon.Realtime.Player player = Photon.Realtime.Player.Find(playerID);
  photonView.RPC("KickPlayer",player);
}

If this is indeed an issue with a sample found through Unity documentation, please upload the full error message you’re receiving and a link to the sample for review.

Regards,
-Kip