What is the most optomized way to make hitboxes?

i read this post
im now confused what would be the most optomized way to make hitboxes

make hitbox part inside the character and use getpartsinpart and check for a part with the name hitbox

make a hitbox tag with the hitbox parts so i can filter them via overlapprams

make a folder with hitboxes which are welded to the character and have an object value inside them that points to the player’s humanoid

Honestly, none of these approaches are really the best, they can work, but in my opinion, I think the best method is using workspace:GetPartBoundsInBox(), and detect all the overlapping things with the bounding box, heres the documentation:
https://create.roblox.com/docs/reference/engine/classes/Workspace#GetPartBoundsInBox

This also might work just fine.

I use .Touched, but when the hitbox is created :GetPartsInPart(). I wouldn’t get too wrapped up in performance, because you’re not running anything every frame. Don’t use :GetPartsInPart() every frame, only on the first frame the hitbox is created to make sure there’s nothing inside.

are you using .Touched on the player’s character parts?
if you are its a bad idea
.Touched is fired from the client so an exploiter can just delete a part that kills him and it will never register that he touched that part

No, I am not. I’m using touched on the hitbox, and the hitbox is of course server owned. I do however, connect a touched event to the hitbox on the client, but that’s for the damage effect, as in the damage number and hit animation. Always do effects on the client.

1 Like

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