Client can't apply damage to server

Hello guys !
I made a line trace system for my sword multiplayer game and i can’t apply damage to the server.I don’t understand why…Here are a few screenshots of my setup:

Thanks in advance i really need help on this one :slight_smile:

Hey Slamyr,

Make sure that first the graph is acting as expected. Set a breakpoint on the Apply Damage node and Damage Life node.

One possible reason is that whatever damages the server has been spawned by the client, and is not known by the server.

Another possibility is that your cast to Joueur isn’t working well, so be sure to drag off from Cast Failed and set a Print there and a breakpoint on the print.

Damage is server only functionality. Your client should call RPC to server if you want to deal damage based on client data, which is bad idea btw.

What would the good idea be then?

Ok so I’ve done the last test (added a print string to cast failed) and it does print the string so I guess its a problem with my cast Joueur (wich is my character btw) ?


Projectile deal damage only on server.

Character receive damage and change health - happens only on server.

Health variable is replicated with notification.

OnRep_Current Health have separate logic for owning client and server.

Ok i’m gonna have a look mate

ok I don’t think that’s the problem as I can attack other players (not controlled by actual persons ) and it works

Ok so i took away the big mess next to my line trace system and went for this (similar to your system).The problem is now my server can’t even attack the client anymore :confused:

yep you’re hitting something else. Print the hit actor and see what you get.

Use breakpoints/print string to figure out what happening there. Does that Hit Event even trigger, if trigger, what is receiving end of the damage. Its not about server-client communication is wrong. The are no communication, in your code. Both event hit → deal damage(because of has authority) and Any damage → change health - happens only on server.

Ok so the component hit doesn’t even trigger that may be the problem here

And my simulation generate hit event on my mesh is enabled

Well the only one i need is the one on my mesh

But do line traces trigger a hit event?

No in fact they don’t :slight_smile: so that is the problem my idea is to create an event after the break hit result and do the damage part on that event.

Ok now i’m getting response to my event.I noticed in your project that you had a damage variable connected to the base damage of apply damage.Does this damage variable correspond to the apply damage one or is it a seperate variable you’ve created?

There are checkmark “generate hit events” which you might be missing.

ok then :slight_smile:

You can test it, its not that hard, but they shouldn’t.