Replicating in HUD

I want my Hud to display the HP of your opponent. I got it working, but only by giving the character pawn 2 HP values, one for being player 1 and the other for being player 2. Otherwise, the client thinks its player index 0 no matter what. I figure there has got to be a better way, thoughts?

It’d be much better to get the enemy’s health directly. So for instance, if you wanted a health bar to show up when you aim at him, your pawn would be doing a trace from the camera, and getting the health of that pawn. Then your HUD could read the value from your pawn and print it on the screen.

If you didn’t want to store the 2nd health value on your pawn, you could make a function (on your pawn) that traces for pawn and returns their health, and call it directly from the HUD.

How would I return that pawn without a trace? So that it was displayed all the time? Its a 2 player vs game, I would like to have it displayed all the time like a fighting game would. The problem I have is that the server returns its health for the left bars and the client for the right bars, but the client returns their own health for the left bar(not the right where they should be) and nothing for the right bar.