How can I make it so clients can harm people?

http://puu.sh/sDgsL/20a1136baf.png

I have a line trace that when it hits a player, it should damage the hit target but with this configuration, only the Server can damage people. (Multiplayer)

This blueprint is in the player’s event graph because I like having everything on one screen and not worrying about linking everything together. I’d like to keep it that way if possible. I’m not too worried about each of the clients handling things.

What I think is going is when a Client gets to the “Apply Damage” part, it stops. Only the Server is allowed through to setting the health, meaning only the Server can damage people because “Hit Actor” is only set on the person shooting.

To stop cheating on the client side only the server is allowed to apply damage. This is by design. Then after the server applies the damage, the health of your character is replicated back to all clients. Then the updated health value can be used to update the client HUD.

I thought that that was how it worked it’s just I can’t figure out why clients aren’t doing damage. I think that the server isn’t actually applying the damage when a client shoots somebody.

In the blueprint you posted above try adding a custom event set to “Run on Server” in front of your Apply Damage node. Then call that custom event after your Spawn Emitter node. I believe this will fix your issue.

http://puu.sh/sDpat/7d91a8caf2.png

If this is what you mean, it looks like it does the same thing. I set some breakpoints and the client only gets to the “Apply Damge” but the server can do all of it when shooting somebody.

See how there is an Icon of a gray PC Tower on the Apply Damage and Event Any Damage nodes? This means that these nodes do not execute on the client, only on the server. Your custom Run on Sever events look good, so the server should be correctly applying the damage now.

I think I was talking about the wrong thing there for some reason. What I should have said is that clients still can’t damage people.

I figured it out. Thanks to you helping me with logic.

http://puu.sh/sDzy8/ccb42a24db.png

I just had to set the hit actor in the custom event and it works!

Epic’s damage system does not allow clients to apply damage and there is a good reason for that. If a client applied the damage then that damage would not get replicated to other clients. In almost every case I can think of this would be bad. In network games, variables only replicate from server to clients. Variables cannot replicate from client to server. This is the reason you have to use RPC (custom events set to run on server) to have a client tell the server to apply damage.