Touched function is unreliable for hitbox

Is there an alternative to touch event? Sometimes it works, and in rare cases it does not.
A skeleton of the code used.

hitbox.Touched:Connect(function(hit) 
   if hit.Parent:FindFirstChild("Humanoid") then
    --  push back
   end
end) 

A video portraying the problem.

no sadly
you could try coding your own touched events but that would be tedious
it could be something to do with how youre positioned, try making a bigger hitbox infront of you

You will need to use GetPartsInPart, as part.Touched isn’t really efficient

while true do
wait(0.1)
local touchingParts = game.Workspace:GetPartsInPart(hitbox)
for i,v in pairs(touchingParts) do
if v.Parent:FindFirstChild("Humanoid") then
push back
break
end
end
end
1 Like

doesnt Touched just return a callback when GetPartsInPart changes??

1 Like

Oops I forgot to put it in a loop, thanks for letting me know though

no i have no idea im asking you

What do you mean by that, I don’t understand what you’re trying to ask

does touched fire when gettourchingparts or getpartsinpart changes?

Touched events are unreliable.

You alternatives are WorldRoot:GetPartBoundsInBox(), WorldRoot:GetPartBoundsInRadius(), WorldRoot:GetPartsInPart(), or any other custom function that works with all the 4 points of a part, and checks their positions.

1 Like

No, they work on completely different mechanics

Why dont you use alternatives like raycast, region, hitbox/zone

– Hitbox


– Zone


– TouchedPlus (That could could really help you lol)


– Raycast (Melees)

2 Likes

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