Cant apply Damage from Client to Server
Hello guys. I know this question propably has already been answered many times, but this is my first try on multiplayer and replication and i still cant seem to get it working. In the character blueprint i set up a simple line trace that calls the apply damage node to cause damage to the hit player.
On Event AnyDamage i subtract the applied damage from the health variable. I set the health variable to replicated, but i can only damage the client from the server. if i play as a client, i can't damage the server
Can anybody explain to me how i can get this to work ?
asked Jan 19 '17 at 08:44 PM in Blueprint Scripting
You need to call Event AnyDamage only on the server. To do this you should create a new custom event that is setup to replicate run on server reliable and have that event call Event AnyDamage.
Instead of calling Event AnyDamage in your Fire input action event you will call your Run On Server event instead.
I would also run the line trace on the server (during the run on server event) to prevent exploits.
answered Jan 19 '17 at 08:56 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here