Replicating/Updating variables in player state

Hi guys, I seem to have got into a bit of a predicament. I store main player stats in my player state (to prevent client hacking on my mp game). I have some stats working such as the players level, I have a debug function that runs on the server when I press “E” and this shows the payers in the server with their level and attack damage. Levels show up fine each player has their own, but the attack doesn’t show up for the client it stays as “0” whereas it updates for the server player.

This is the talent tree widget that the client uses to select the talent attack increase. Top left shows the client printing the attack is “10”

Here I have used the debug function on the server (client is player ending in 564D) as you can see both are still 0

Here the server uses the talent widget and selects the attack talent point

This shows the debug and shows the server character with the attack increase

So obviously the clients variable isn’t replicating and only setting it on the client itself.

1 Like

This shows the blueprint when a talent point is selected and inputs 10 to the attack increase function

This is the attack increase function.

I use the attack variable in my character blueprint and add it to the weapon damage, which equals the total damage caused by you.

Solved it

As you can see levels are different and both the server and client have selected the attack talent and works fine :slight_smile:

I basically added a custom event in the player state that runs on the server so the server knows to change the variable. After that it worked fine, I then realised the characters damage wasn’t updating, so looking at my character damage blueprint, I casted get player state from self instead of player controller and it worked :slight_smile:

Yep, all “truth” must be executed on the server. Thanks for posting your detailed solution