In my game I recently made the change from Region3 hitboxes to Raycast based hitboxes, and one issue I ran into was that it became harder to find the ancestor character from the detected hit part. This arises from Hit.Parent:FindFirstChild(“Humanoid”) which I do not know why. If the sword was to hit the character’s accesories, it just simply wouldn’t find the humanoid. Any help on how to do this better?
How about using IsA to detect the character?
local char = Hit.Parent:FindFirstAncestorWhichIsA("Model") will fix your issue. This occurs because handles(the parts of accessories) are parented inside accessory objects which means you have to use
Hit.Parent.Parent for most accessories.
First find the character and confirm if it has a humanoid.
local character = hit:FindFirstAncestorWhichIsA(“Model”)
local human = character:FindFirstChild(“Humanoid”)
This seems like a good way to do it:
if hit:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Humanoid") then --do code end
This will include accessory handles (which are BasePart instances).