2D character sprite not replicating correctly

Hi, I’m facing an issue, where my 2D sprite character’s direction doesn’t replicate on clients. I use this event on my event tick to check which direction the player is facing and then setting the sprite animation to play in the direction the player is walking.
It replicates from the server host to clients well but the clients don’t change directions when walking down for example.
I know I’m doing something wrong in the blueprints but I’m not sure what.

Hey there @M33TO1H1N! I think a variable paradigm would probably do this a bit better. An example is how I handled the teams and material changing for another member on the forums. I start by splitting it into pieces, the input from the client, the server deciding, and then the clients getting an update call to check what was assigned. This is a bit redundant, but assures players stay up to date even if they join after the fact.

Hope this example helps! If not I can try to replicate the way yours handles on my side.

Hi, I tried creating seperate events to set the direction on the Enum dependeding on the input. Then I created another event to check the direction and set the flipbook of the sprite depending on that but I get the same issue. I’m not quite sure why it doesn’t replicate to the clients.

Hey there @M33TO1H1N! I entirely missed posting the actual image I was referring to!

So this is on the players BP, all it does it make a server called repnotify for which team they selected, then a multicast to tell all players to update their team. In this case, you can use this for the sprite when it changes.

Oh I see. With some tweaking I got this working perfectly, thank you.

Yeah sorry about that! I bounce around questions so fast sometimes the screenshot at the end doesn’t come out. I use this paradigm for almost everything that needs to be called server side and reverified player side after replication. Just for some extra reference, I refer back to this document by one of our awesome community members Cedric Neukirchen who wrote an amazing PDF for networking that is probably my favorite bit of Not-documentation. This is what got me started with networking in UE4 and I highly recommend it. It’s still accurate to UE5.0.3 at this time of posting!

Disclaimer: Cedric is a community member not affiliated with Epic Games, and any links to external sites are at your own discretion. Epic Games is not liable for anything that occurs outside of this domain.

Thanks, I’ll definitely take a look at the document.