My gun uses ray casting for the detection system. If it detects a possible descendant of a player's character, it fire a remote event to be handled by the client. This works fine for the torso, head and arms, but when I try shooting on the legs, it completely ignores it and goes though it.
Shoot function in the Local Script:
local function shoot()
if not aiming then return end
--//Initialziation
shot:FireServer()
--//Ray
local ray = Ray.new(hole.CFrame.p, (mouse.Hit.p - hole.CFrame.p) * range.Value)
local hit, position = workspace:FindPartOnRay(ray, player.Character, false, true)
--//Hit Detection
if hit then
print(hit.Name) --I added this here to debug, which is how I found at that it passes through the body parts.
--//Check humanoid
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
--//Get target player
local hitPlr = players:GetPlayerFromCharacter(hit.Parent)
if hitPlr then
--//Hit a possible target
hitRemote:FireServer(hitPlr.Name, hit.Name)
end
end
end
end
Something I feel is really important to mention is that, I tried shooting at a spawn location, and I noticed it went through and printed the base plate instead. This happened when I tried shooting on the sides, but not the top.
Any help is appreciated.

1 comment
Thank you for the detailed answer, I feel bad it for you. It was only an issue with the math. Thanks for the answer though!