When I attack another client I take damage

So my character is playing as client 1 and i want to deal damage to client 2 when i attack and my sword overlaps, my problem is when i attack as client 1 my health decreases and vice versa, the image is from my character blueprint

Also i have no idea how inefficient or wrong i am with that cluster of custom events for server and multicast but it’s been working well for other stuff

Any help would be greatly appreciated

Thanks for the useful info, i took them out but it didn’t solve my problem

Alright so…

First of all, apply damage is being called on the server already, so everything between your branch and your on component overlap are doing nothing for you. Take them out and try them again.

Ok so looking back at this, I see that you’re trying to set your health in your HUD. Shouldn’t you be setting it in the character blueprint? This should fix a few other problems for you.

^^Try that first, then test.^^

If it still doesn’t work, then on the apply damage node, connect self to event instigator. After your health is set, get the display name of the event instigator. Make an append node, and connect it like this…

A-Display name of the event instigator
B- " Hit "
C- Self display name.

This should basically tell you if your own character is hitting himself somehow.

Thanks again but the problems still there, i don’t think i’m setting the health in the HUD just putting my other widgets there so i only need to cast to the HUD, been using print string and the clients definitely aren’t hitting themselves, now event any damage isn’t being called and if i skip it out and plug apply damage to the rest of the nodes only the first two clients have their health affected.

Is your health a variable in your character? It should be right?

Make sure it is replicated. Set it with your event any damage, and have your health bar widget bound to your health divided by your maxhealth.

Yeah the health variable is setting the progress bar percent and the event any damage is being called it’s just not valid, but when i remove that i get an accessed none error from the HUD reference and the cast to HUD isn’t failing

In my character blueprint there is a float variable called health, and that variable is plugged into set percent of the health bar, is that what you meant?

I’m not sure if Im just pushing you to do something you have already tried, or what, but you need to set your character’s health variable, not his health percent in the widget.

Yes. You are setting the percent right now right? You should be setting the health variable. The widget should then get the correct percent automatically, if everything is set up right.

There’s still a misunderstanding i’m setting the health which then sets the percentage.
What you’re saying is i should not set the percent but set the health variable (which i’m already setting) and somehow that alone will update the widget?
Or i should plug the health variable into set percent and (if everything is set up right) it will work?
The health bar does update it’s just going to the wrong client, also my cast to HUD works but accesses none

In the screenshot you are setting the health in the widget. You need to set it in the character. I’m not sure if you changed it already or not.

Post a screenshot of your updated blueprint please.

And yes I am saying that you should not set the percent, but set the health variable and that alone will update the widget if everything is done correctly.

If you aren’t sure if its done correctly, then get an event tick node, switch to authority only, and print the health variable.

How would you suggest i change the percent of the progress bar without setting it, the ‘if everything is done correctly’ what you’re thinking of could be the solution