How to make secure client sided hit detection

So i’m making a fighting game. And there will be hit detection. We all know that server sided hit detection is really laggy and unresponsive. So I did client sided hit detection and uh… the problem is. Whenever I want to make a hit detection part, the server has to send all information (Damage, Range, Part Size, etc…) to the client who’s making the part, This is my biggest problem yet since it’s really really easy to exploit. So is there a way to make it more secure? Like what checks shall I do and how?

When somebody is hit check the magnitude of the object doing the damage and what got hit with a server script and an if statement.
Setting it to about 8 studs as the max should be fine although people can still extend the hitbox. If you want to make it hard to exploit then you can check the length of the object doing the damage and setting that as the max plus 2 or 3 studs. If you don’t add any studs it will be inaccurate like the server in some cases.

You should be able to check the magnitude with

(MainObject.Position - HitObject.Position).Magnitude

I can’t help with much past hitbox exploits though, sorry.
Hopefully this helps

Haha. You can’t.

There’s such a thing known as “client-side prediction”, where the client will preemptively play a bunch of damage effects before the server says that it hit, making it feel more responsive.

There’s also time travel, where the server records where all the hitboxes are every frame for a second, and then does it’s checks on that.

These two are both pretty common in multiplayer FPSs like TF2, CS:GO, Valorant etc.

2 Likes