Replicating in Player Controller

Hi guys,

I’m making typical third person game with mouse control. I’m falling short at finding a way to select a target by left clicking it from the client since I can’t find a way to update the servers target variable along with the clients.

What’s happening right now is the server is reporting No Target when prompted since the Hit Result Under Cursor is only returning the data from the client, and setting the variable from the client isn’t updating the server.

Can someone shed some light here?

You’ll probably need an RPC call (replicate to server) anyway, simply send it as a parameter on your RPC event from the player to the server.

I know the network replication is difficult to understand at first and as usual, there are multiple ways to do things.Only the owner something can change it’s variable. Most of the time PlayerController is a bad place for variables, because this class only exist on the server and the machine of the specific player.

If this does not help you at all, look at the replication documentation and/or show us what you’ve got and we tell you what’s wrong with it :wink:

Hey, Thanks for the reply. This is a simplified version of what I’m trying to achieve:

I’m a little new to the whole networking thing. thanks for the understanding.

I think I’ve just worked this out. I was unaware that you can pass values directly into the custom event node that should give the server the appropriate client info instead of using its own mouse location which is obviously wrong. This was essentially a lack of understanding of replication. Will mark your answer. Thanks for the support.