How to optimize hitbox

I’m making a fighting game which uses melee as the main way of combat, and i have this problem:
The hitbox (which is made in the server) is delaying or not following the player correctly.
I never figured out how to optimize it best, and i would really appreciate if anyone could show me a way to. I’ve heard about making the hitbox client-sided but every time i read about it everyone says it’s exploitable, so i’m not very sure what to do about it.

My method uses workspace:GetPartBoundsInBox() to detect the hits and the red part is a representation of the hitbox.

Thanks!

1 Like

That is because its from the server, not by the client, you will get latency when you do that, if you want it to be client friendly, but exploitable, then do some more in Client, like sending the part list or so. I’d honestly not find much of a matter in it if it doesn’t affect gameplay. You can try compensating it by adding a bigger hitbox

4 Likes

Yep, this - register hits on the client, validate whether they’re reasonable on the server and then you should have no (or barely any) issues.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.