Need help with parttouched hit detection

I have a system in my fighting game that utilizes the part touched event. Basically, whenever a player clicks the animation plays and when the animation reaches an animation event it creates a hitbox, the hitbox destroys when the animation ends aka the stopped event. So my problem is when I increase the animation speed sometimes the part creates and destroys so fast that it doesn’t register any hits. Any feedback/help is appreciated.


Hopefully I can be of assistance to you, but one thing I would like to know is how are you registering the hits? Via RemoteEvent, OnTouched, etc.

1 Like

The .Touched event only fires when a part collides with another part. If the .Touched part is gone before any parts bump, you are going to need to use a different method at getting touching objects.

You could try using :GetTouchingParts(), or a Region3 and Workspace:FindPartsInRegion3().

1 Like

Yea, a script preview or such would be helpful as well as any errors in output if such :slight_smile:

Right, so basically to renderstep I check if the hitbox exists and if it does then it checks every single frame that that hitbox exists for a hitpart, after hitting something it adds the hitpart to a table and if that hitpart is in the table then it wont deal the effect to that specific hitpart. And the hitbox’s detection itself uses part.Touched and the GetTouchingParts method.
Here is a video of my problem.

Instead of trying to figure out what the character is touching, why don’t you just cast out a Ray in front of the character a few studs, and see if it collides with anything?

Since you are using a table, have you considered checking everything that’s in the table with prints?

Actually I want my script to have a certain hitbox, I have done raycasting for hit detection in my previous works, however, for this game I wanted freedom to control hitboxes for my punches.

As you can see each hit has its own hitbox.

No I haven’t yet, I’ll try it and reply.

I asked if you checked everything that’s in the table with prints, because it could potentially be that the .Touched event is maybe firing but the method you used to call the effects on the hitpart may be the issue.

For Instance, if the part is still touching make these effects.

The problem I have with printing all the hit parts is that it severely lags my studio so I can’t capture the bug with it.

And yes, it did print the hitparts

So what method are you using to produce the effects of the hit?

If you aren’t already, try to call the effects before adding the part to the table.

I think raycasting is the best solution for melee combat detection, but If you are certain you want to use a system like this, you should use Region3’s in my opinion.

You can use the function in this(or a much simpler function like this, if you so not care about the orientation aspect) post, in order to convert your part into a Region3. Then you can just use workspace:FindPartsInRegion3() to get a list of all objects inside the area.

This is going to give you the most consistency in your checks.
The only downside is that Region3’s can be performance heavy in some cases.

1 Like

It checks if the hitpart is hittable then it creates a mesh part(the effects are just a mesh part) at the CFrame of the object hit, if the hitpart has a parent and that parent has a humanoid then it damages the humanoid and adds the humanoid to a hitHums table. If that humanoid is in the hitHums table then that hitBox wont deal damage to that specific humanoid again.

I don’t think it is a problem with the hitdetection rather a problem with the creating of the part itself.

1 Like

Randomly one of the hits in the combo will just not create a hitbox as shown in the gif below

I have slowed it down and (left hand) is having trouble touching the thing

1 Like