Combat System Approach
Alright, first things first let’s go over how FE works and how we can come up with the best way to use this to account for latency and remote lag. Firstly, FE latency is around 0 to .3 seconds, not always, but mostly. Items made on the server will automatically replicate to all clients, and items made on the client will not replicate. (Also, the client is much better for handling things like Tween and CFrame, so if possible, be sure to use the client to move things.)
The server and client communicate with RemoteEvents and RemoteFunctions.
There are multiple approaches to do a combat system, and the one stated below is a rough sketch of how I would do it.
My approach
When punch is requested, play the animations and sounds on the client (we do this so the player can experience no delay in seeing their punch, so they feel like there is no lag when in reality there always is). Once this is done, we fire a remote like so:
punchEvent:FireServer()
We fire to let the server know we would like to punch something, but do not put any parameters in this!! By putting a player name or anything else you are creating a security risk, the client should not have any power. No power to the client!! The server will manage all the data.
Once the server receives this, the server will replicate the sounds and effects to the other clients by firing a remote to them.
The server can now manage the main interaction. From here, the server can calculate the closest player using magnitude, or preferably, use a .Touched event and deal the damage toward the other player if conditions meet up.
Of course, do not forget to add a cool down on the server so the exploiters cannot spam fire the punch event. And let’s add a cool down to the client as well so they cannot spam the client animations when pressing the punch button.
You can add a “-10” HP GUI above their hed when they are attacked as well if needed.
This is fully customizable and can be done in many more ways than 1. The solution I presented should be enough to suffice for multiple factors, but may not be exactly what you’re looking for. Be sure to play around with the code and conduct multiple tests.
I hope this helps and best of luck!