How do I make a clean hitbox?

I tried using rays, and magnitude, but I feel as if I’m always doing it the wrong way. Is there a specific way to make magnitude, and ray hitboxes work the way I want them to so players don’t miss half the time they’re attacking with melee weapons?

Miss in what context? Miss as in the hit isn’t registering with another player or miss as in the weapon isn’t coming into physical contact with the other player?

I’m going to assume it’s the former in this case (as well as that you’re using .Touched or had used .Touched). If you’re relying on the server to acknowledge if the weapon touched the player, it will appear on the client that it physically came into contact but wouldn’t be recognized on the server. This is due to the latency between the client and the server. My only solution to combat this is to retrieve the Touched event on the client and then send the damage information to the server (of course with sanity checks to ensure the event was fired with a legitimate reason).

In the case you are using rays and/or magnitude, as I said, you should do this on the client to make it seem like there’s no lag on their end.

However, by trusting the client, you’re also trusting that they won’t exploit on their end to give themselves an unfair advantage or to grief the server they’re in.

You can always try rotated Region3 or GetTouchingParts if you’re looking for alternatives to the methods you mentioned. However those methods you use usually work pretty well, so I would recommend reading over your code again.

1 Like

What’s your current progress? How are you currently using magnitude or raycasts to create hitboxes, or how did you do so before? It would help to know what you’ve tried so we can build upon that or offer a clean from-scratch solution.

That aside, I’m going to drop one of my more favourite resources… check out this raycast hitbox module.

1 Like