I have a touched event that triggers when a hitbox detects contact with a hurtbox.
However, it doesn’t happen consistenly for some reason.
Here’s the output (server)
These were taken when the player is in very close proximity to the opponent, so on paper, all of these hits should be detected
The script prints the player the hitbox belongs to and then prints the hurtbox it makes contact with.
The rest of the script doesn’t continue if it makes contact with the owner’s hurtbox, so there’s no need to worry about that
The hitbox fails when it doesn’t register the other player and doesnt print “hit player2”.
hitbox.Touched:Connect(function(touched) if hitActive then print(hitboxOwner.Name .. " " .. touched.Parent.Parent.Name) if touched.Parent.Parent ~= hitboxOwner then touched.Color = Color3.new(0.666667, 0, 0) --Changes color of hurtbox print("hit "..touched.Parent.Parent.Name) hitActive = false removeHitbox() hitboxOwner.Pause.Value = true touched.Parent.Parent.Pause.Value = true RCEvent:Fire(nil, 0.1) --Pauses animations wait(0.1) touched.Color = Color3.new(0.333333, 0.666667, 0) --Returns the color of hurtbox hitboxOwner.Pause.Value = false touched.Parent.Parent.Pause.Value = false end end end)
What causes touched to be so inconsistent? Is there a way around it?