I am trying to learn the basics of doing Multiplayer Networking in blueprints, this should be a basic thing. When the player walks up to the door, an interaction key is pressed down for a certain amount of time until a timer runs out and the player is teleported to where they need to go.
Teleportation works, the issue is, it only teleports the player who is running the server, and none of the clients. Here is my code:
In the Set Actor Location you are only ever teleporting index 0 player. Assuming you are using listen server, it would always be the listen server character. You need a way from the server to tell which player character to teleport.
If you have some sort of player ID saved, use that ID to find the pawn you want to teleport from the server side.
You don’t have to manage player IDs yourself if you don’t plan to. You can pass in playerController/playerPawn as variables to server. And server would can use these to teleport player instead.
Add a player controller variable to your Run on Server event. Each client including listen server, the index 0 is always their controlled pawn if they have one.
On the on your Interact interface, add another variable “Pawn” to pass in. Server can get player’s pawn by Get Controlled Pawn. You can teleport that pawn.
I am a little confused here so am I gonna try to run through it. I have the interaction code be on the actor being interacted with, not the interacted. But how do I push things to the server and from the server, do you know where in the documentation I can find this?