I have a ray casting pistol but if you hit a hat it doesn't register. Things I've tried to get it to find the humanoid through the hat.
local hum = hit.Parent:FindFirstChild("Humanoid")
if not hum then
hum = hit.Parent.Parent:FindFirstChild("Humanoid")
end

2 comments
Okay thanks. So this here would find the hats and to ignore them I would do (if hit.Name ~= "Handle")?
If you wanted to ignore the hats (players cannot take damage from hat hits) then yes