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.
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.
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.