Player State
For replicating correctly health bar we need Player State.
Player State exists in server and every client has their own Player States too.
Create new Player State in GameMode folder.
Open Gamemode and change Player State Class to what you just created.
In Player State add all these variables.
Values that you wan’t to display to client simply set them to Replicated.
Create PawnBegin Event. This will be used when game spawns a new pawn.
UpdateDamage Event.
This should also have Death recording but i’ll leave that to you.
Go to Player Controller and find RetrievePlayerId…
At the end of it send Player id to Player State’s PlayerIDCustom variable.
Also go back to GameHUD and add this in Event Tick.