How should I go about making a hitbox?

I’m trying to make a normal combat system with a block and punch mechanic.

The issue is is that when a player punches someone and moves, the hitbox has no effect. I tried to set the network ownership of my hitbox to nil but my hitbox is anchored.

I’m wondering if using an alignposition and alignorientation with my hitbox is a good idea to solving this issue and then setting the net work ownership of the part to nil or should I just leave my hitbox anchored?


I suggest that you use spatial querys to make hitboxes, such as WorldRoot:GetPartBoundsInBox.

RayCasts, ShapeCasts, Touch or BoundingBox.

GetTouched & BoundingBox are quite alike.
ShapeCast is just a bigger & fatter RayCast, so if the character is really small you can still hit them.

I highly suggest ShapeCasts over either, because this allows you to have a more realistic fighting game.

  • GetTouched is really easy but may be inaccurate (.Touched is inaccurate).
  • BoundingBox is the better variant of GetTouched, this one is easy to use.
  • RayCasts are widely used, lots of modules, but you have to get used to them.
  • I believe there are not a lot of combat modules which use ShapeCast, but I might be wrong.
1 Like

I’m using GetPartsInPart for my hitbox but I’m wondering how I can fix this issue of unresponsiveness.

To fix this I was thinking of using constraints and setting the network ownership of my hitbox.

This is my combat, you might be able to tell how if you move a lot you may have no damage at all.

Weird, when I play in game it works perfectly but in Studio it’s sometimes unresponsive.

Make the part a killbrick of sorts. If a player touches the hitbox, it takes damage, much like how you would code a killbrick for an obby game.

There are many ways to do hitboxes (like what the others have mentioned), but what I usually use is raycasting due to its performance and precision.

If you were to use raycasting, I suggest using modules like ClientCast (client-side hits, better for user experience – the exploitability and ways to circumvent it can be read in the post) or RaycastHitbox4.01 (good ol’ serverside, trades user experience for safety)

But then again, raycasting isn’t a one size fits all answer – depends on your usecase.

1 Like