Replicate Not Working on Client Side

Hi all, I’ve recetly switched over from Unity to Unreal and thought it was a great idea trying to get networking to work for my prototype. It was a very bad idea.

I’ve essentially set up some actions for my character; hold LMB + Swipe mouse in a direction to hold a melee attack in that direction, then release to finish the attack. It works fine on the server side, however it does not work past the Print String Node “Between Lobby and Branch”.

][2]

Does anyone have any idea how I can fix this?

Apologies for the noobiness,
Thanks!

-Edit- Just to expand, the client is able to see the server perform the melee attacks, however the client cannot perform them at all (on the client or server side).

While there seems to be a lot going on in your blueprint, I can tell you that the first step to your issue is that your client isn’t being told anything with your event dispatcher “Attack”. You have the dispatcher set to “Execute on Server”, which means it will do just that and not replicate it to your client (even if you’re calling it from your pawn blueprint). If both the server and the client need to execute the logic, then I recommend you start using “Multicast” instead - which the event dispatcher almost always needs to be called from the server. Replication can be tricky to learn at first because you need to understand what exists on the server versus client. I don’t want to be one of those “go watch a tutorial”, but there’s a lot of information to understand when it comes to replication.

I don’t know the full extent of your project, but my guess would be that your flow should look something like:

  1. As the client, player gives input to perform attack (ex: left click)
  2. As the client, tell the server that you have initiated an attack (This is the step where it gets complicated depending on your project needs)
  3. As the server, process the client initiating an attack
  4. As the server, tell all other clients that the invoking client has performed an attack (you’ll use Multicast here)
  5. As a client that isn’t the invoking client, process the invoking client performing an attack

The Networking Content Examples might be nice comprehensive documentation for you to read, moreso what’s specifically happening in your case here is Function Replication

Thanks so much mate, I finally got it working!

For anyone who is having the same issues, I basically did MemoryKiller’s steps;

  1. Perform the action on the client like you usually would
  2. Tell the server to perform a multicast which performs the action serverwide.

I’m not 100% sure if this is totally what you meant, but it works and I am happy :smiley:
Thanks again!