How to replicate this function with string input?

I am using 4.10.1. First of all, I’ve seen several tutorial for replication and I get how most of it works and have done a few tutorials. I am very confused as to why this isn’t working. I know it is something I am doing wrong, but I do not know what. This is probably really simple but I’ve been trying to figure this out almost all day.

I have a UMG widget with some text boxes and lines. The lines are populated by a string array in the controller of the client. It all works perfectly except I cannot for the life of me get the function to call on both clients at the same time. Also for some strange reason if I use a custom event that replicates via multicast then I can no longer move the camera (I’m using a spectator pawn instead of a normal character) and it snaps to the exact position it does when it spawns.

Bluntly, I am trying to call the function with the string on both the client and the server so they get the same lines of text.
I want the lines to be the same.


My attempt to call the function on both client and server at the same time. The stuff on the right leads to the function that takes the new string and adds it to the string array variable, which is not replicated. This is being done in a PlayerController if that matters.

Continuation of the above.

Function that moves strings.

Function that adds the new string.

------Followed vanlacke’s advice------

I moved everything into a character called NewCharacter instead of the playercontroller.
Error I get and the replication for NewCharacter, for some reason the Event Begin Play calls twice on the server.

The current result. Print string DOES get called on both the client and the server, but for some reason Move String and Add String do not add anything if it was called from the other, but the print strong node DOES fire on both client/server and the client.

Add String, now in NewCharacter

Start Up, a function called by EventBeginPlay when the NewCharacter is made.

Move string, now in NewCharacter

The Event Graph in NewCharacter my character. The only thing in the player controller is something enabling the mouse cursor.

Tough to determine what the problem is with the amount you showed. Can I see the rest? Also, I assume you’re trying to create a chat system, right?

The problem is you’re doing all the important stuff in the controller. The player controller only exists for the client and the server, hence multicast won’t work because the client controller can’t communicate with the other client controllers.

Run everything that requires communication to more than one client somewhere else, like the pawn, which does exist for every client. Assuming everything else is working, doing that should fix your problem.

Here’s a simple test you can do to better understand: Print a simple string using multicast. On the player controller, only the controller who ran the event and the server will print. On the player pawn, you’ll see that every single client + the server will print.

Yep. I want to understand the networking better and this is the first thing I am trying to do. I have updated the question with all the images of the relevant stuff. Am I missing anything?

I like to use the game state for player broadcasts.

I took your advice and updated the question with new pictures showing what is happening. For some reason, my function Server: Add & Update Strings DOES get called on both client and client/server BUT the string still does not get added, however I know it is accessing Move String & Add String because it calls the print to screen inside Move String but the string on the other end is moving or being added to. There is also a print string after those functions, and it does fire showing exactly what you said the client prints to the client and server, and the server prints to the server and client.

If Client 1 inputs A, it prints Server: A, Client 1: A and vice versa, but the String Array only updates on Client 1 not Server even though it just proved that it called the event and has the string.