Teleportation in Multiplayer

Hello,
I recently started to create a multiplayer game and knowing nothing about programming I used the BP system. Now when I try to teleport my character as a client I only teleport for the briefest of moments like a tick or so and then I get back to my origin position. When running on the server however it works perfectly. Same thing happens when I want to destroy an actor: works on server but no on client. I want to create an respawn system where the character is destroyed and then created and teleported to the spawn position. I tried using this system both in the level blueprint and thirdpersoncharacter BP. I recreated the basics of the system in a new thirdperson project and encountered the same problem. So after looking around on the internet and rewatching all the guides I can’t seem to solve the issue.
I hope you can help me in my struggle.
Thanks in advance!alt text

Since the actors are replicated from the server to client (not the other way around!), you’ll need to execute all actions that should affect all players on the server.

Basically, in addition to the Teleport function, create a custom event (in the same Blueprint) that calls the matching function. In the Details panel of the event, set the Replicates property to Run On Server. Then replace your current function call with a call to the event instead.

The server will take care of moving the character and then, because the characters and their movement are replicated, inform all clients about the updated location.

The same applies to spawning and destroying actors.

I found this video series extremely helpful:

Also, right now your characters will always teleport into a fixed direction. If you want to make this depend on their current rotation, you can use the GetForwardVector:

Good luck!

PS: Try cropping your screenshots. They’ve got these huge white borders right now.

Thanks Alot! Worked like a charm. WIll definetely take a look at the tutorial again.
Take care and once again thanks!

I seem to be having a similar issue, that this soluition did not solve.

I am trying to create function in which the player can push a button that will teleport them to a room, and then the same button teleports them back exactly where they came from.

This is the blueprint I am using on the level.

The teleporting works perfectly for the first player
but any other player who connects to the level does not teleport.

It seems to me I have to somehow reference which player is calling the teleport function? perhaps with the player index?
I dunno :frowning:

any help would be great.

Thanks

You should code stuff like that in the Level Blueprint. The Level Blueprint is the same instance for all players in multiplayer, and you are referencing the PlayerPawn for the Player number 0 directly.

It would be better and easier if you would code this in your playercharacter directly.

Cheers,

I tried that, and had difficulty referencing a target from within the player…

I’ll try again, I suppose. :confused:

Ok. Got 'er going… thank you.

This incorporates my needs and the fix required to make it work in multiplayer

I made it for you :slight_smile:
First I must what is problem.it is “Replicate Movement”!
I try some way and finally find 1 solution!
I know it’s ridiculous, but there’s a way to solve that problem without change the replicate setting!

For client responsiveness (not waiting on the server cause high ping) you can teleport locally, then call server RPC.