Download

Pass position pawn from client to server for move pawn

Hi all, i have a little problem that i can’t solve. I create 4 pawn from the server, and i control the pawn from 3 client (+1 host server), of course the host don’t have problems, when he moves he is replicated by all clients to perfection
BUT otherwise (the clients) no, so I’m looking for a way to " tell" the server where clients roam.

So i think “i can send a vector with actor position from clients to the server and then move the respective pawn with set actor location ON the server that update all clients position”. My logic is correct ?

This is what i’ve done:

Client (2° player)

29f6012be72dabdc81f0430d097c0188e4771c1b.jpeg

Server Side

9c8817f3595d35c638a30437ea138a75eb72d337.jpeg

I made this with print for see if the vector “vetttore” that i create on server will be update from client, and of course he don’t. With this structure he always print the default position of the player, BUT if i manually write XYZ on the client all work perfectly (???). Is like “get actor position” don’t work well directly from client to the server variable…

Sorry for my English , but if anyone can help me please help : (

Tried passing a string instead a vector for test but same problem, if i write the string it works but if i try to pass the string from another string don’t work : >

e49dbedcd43202020ab5809e65cedb6ba6f19711.jpeg

Always default position for player 2 :mad: :mad: :mad:

Well, you are not sending the Server data.

To send the Server data from the Clients, you need to be on the Client (Remote, not Authority) and then call
a Server RPC to get to the Server Version of the Actor.

Also: Clients can’t replicate stuff on their own. They need to to these Server RPCs and let the Server set the
Replicated Variable.

They can also NOT access the GameMode. I hope you know, that the GameMode is only available on the Server side.
And i hope you actually set your GameMode Class the the default one in the Project and Map Settings.

Furthermore, you don’t really need the Variable to be “RepNotify” or?

Thanks for reply. Yes my gamemode is the default gamemode.

I don’t understand a thing: I tried to create a variable (vector) on the server and set with an rpc on the client how you said, it works ONLY IF i set it manually but NEVER if i pass a value from the client. The problem is that i need this. I need because the server create the pawn but is the client that move him, if getactorlocation always pass the default position i really don’t know/understand how i can tell the server where the pawn is.

Can i ask you if you have a blueprint example to let me to understand ?