I am simply trying to replicate a variable in my game (Net Mode = Play As Listen Server).
My player has a variable that is called CurrentHealth wich is set to 100. When That player then presses 1 on the keyboard it chould subtract 10 from the CurrentHealth variable.
NOTE: The Current health variable is set to replicated
When I press 1 on my keyboard (in the server window) to take damage the, the server says that it took 10 damage but the other two clients says that the server took 20 damage.
If I do the same thing in but as client 1 (top right window) the same problem occurs. The server says the client 1 took 10 damage but client 1 & 2 things that client 1 took 20 damage for some reason.
Replication is when you SET a variable on the server only. It then eventually gets replicated to everyone.
You should start by making “CurrentHealth” RepNotify to you get a function which notify you when the variable has changed.
First you use the Input event that calls a RunOnServer event.
Secondly you SET the Current Value on the Server.
Thirdly you use the OnRep_CurrentHealth function to react to the health value changed.