How do you increase responsiveness when making melee combat?

I’ve been trying to make combat system for almost a year from now.

i have tried multiple method to detect hitboxes, from the simple .touched to raycastings. But i still have a huge problem with hitbox detection. and the problem is the responsiveness of the hit.

When a player attack, the server will see their position slightly behind the player’s client side position which lead the hitbox to be behind the visual attack. The player will see their sword hit but the server will not.

What could be the solutions to this problem? What method do you use to counter this latency?
x3yBK3ZRiH

4 Likes

In this case, your best bet would likely be client-sided hit detection, followed up with a server-sided feasibility check.

For example, using BasePart.Touched, Region3s, or raycasting would all work to detect the hit on the client. When the client detects a hit, send that information to the server, and perform a basic feasibility check by verifying that the player’s character position could have successfully made the hit. For example, simply verifying that the position of the character is within ~20 studs of the target.

Such a system would be pretty rudimentary, but should still work fine and prevent superficial exploits that may be opened up by implementing purely client-sided hit detection.

9 Likes