Hello and thank you for taking your time to help me.
I have a replication problem. I want players to show blocks of a specific color that has been drawn beforehand. My problem is that I can’t get all the players on the same server to see the block in the color of the player who placed it and not their own color.
Example:
- the green color is drawn for player 1
- the pink color is drawn for player 2
- player 1 places his block (it appears green for him but pink for player 2)
I want player 2 to see the green block and not pink.
Here is my code:
Thanks in advance.
In what blueprint is the top code located ? Is it level blueprint ?
The color change event is called on each client independently, and each client is assigning a random color to each character, without any sort of synchronization.
Instead, you should run the Color change event only on Authority side (use a HasAuthority check), and then replicate the Color variable to clients (enable Replication in the variable properties).
I’m not sure what the end goal is, but at least this should be enough to fix your current problem.
Adding to this The Server should be the owner of the Block. It should spawn it (replicated Actor).
Player Requests the server to spawn and color. Server spawns, colors the block.
Having the Cube Actor set to replicate should do all the networking for you.
example working on the same principle.