Teleportation in multiplayer? How to target players?

Alright, so I’m creating a multiplayer game and I need to be able to teleport the player using a UMG button. When the player clicks the “Return Home” button in the menu, they should teleport back to their home location.

It currently works fine for player 0 (the server) but it does not work for any of the clients. The clients simple respawn at one of the default player starts instead of teleporting to the specified location like the server does.

How can I target the correct player pawn? How should I setup teleportation in multiplayer?

Thanks!

So I found a solution to this.

  1. Create an event on the player controller called “ReturnHome”.
  2. Set the event replication to “Execute on server”.
  3. Add an input to the event called “PlayerID”.
  4. Use that player ID when calling the “Set Actor Location” function to target the correct “Get Player Pawn” ID.
  5. In the widget blueprint, cast to “ThirdPersonPlayer” and call the “ReturnHome” event while feeding in the player ID.

This way the client or server will tell the server to execute the event with the specified player ID.