Why is my ray only hitting the humanoid root part?

When i raycast with the gun i’m making, for some reason the ray only hits the humanoid root part, but passes through any other part in a character. The visualised ray hits where it is supposed to though so it doesn’t make sense:
raycastbadlol2 raycastbadlol1
(first image damaged player, hit part according to output is workspace.Player.HumanoidRootPart, so thats good)
(second image didn’t damage player even though it is supposed to, hit part according to output is wokspace.Map.MeshPart which is one of the parts making up the border of the map, note how the visualised raycast stops just before the character’s head)

script that does the raycasting:

fireEvent.OnServerEvent:Connect(function(player,FromP,ToP)
	local RayCast = Ray.new(FromP,(ToP-FromP).unit*500)
	local ignorelist = workspace.Map.Spawns:GetChildren()
	table.insert(ignorelist,player.Character)
	local Part,Position = game.Workspace:FindPartOnRayWithIgnoreList(RayCast,ignorelist)
	local Dist = (ToP-FromP).magnitude
	if not Dist then Dist = 500 end
	local Lazer = Instance.new("Part")
	Lazer.Parent = game.Workspace
	Lazer.Anchored = true
	Lazer.CanCollide = false
	Lazer.Color = Color3.fromRGB(255, 247, 0)
	Lazer.Transparency = 0.5
	Lazer.Size = Vector3.new(0.1,0.1,Dist)
	Lazer.CFrame = CFrame.new(FromP,Position)*CFrame.new(0,0,-Dist/2)
	game.Debris:AddItem(Lazer,0.2)
	if Part and Part.Parent:FindFirstChild("Humanoid") then
		damagePlayer(player,Part.Parent)
	elseif Part and Part.Parent.Parent:FindFirstChild("Humanoid") then
		damagePlayer(player,Part.Parent.Parent)
	end
	print(Part:GetFullName())
	local amount = 2.5
	reloadFunc:InvokeClient(player,amount)
	fireEvent:FireClient(player)
end)

i tested the ray hitting the player’s arm and legs and they both do the same as image 2 (looks like it hit but it didn’t)

the problem isn’t to do with the map, i have tested it on different maps and a baseplate and the problem still happens

It could be how your character is facing potentially. If your facing your back towards your target then your ray might get screwed up.

that was on the local test option with 2 players so it was another player shooting the one in the image, so the ray was from player2’s gun shooting at player1 and player 2 was facing player 1 so that wouldnt have been the problem and anyway the ray should still work even if they are facing the wrong direction because their character is in the ignore list

If someone can find a working simple gun model that would be ok too since i can just edit it slightly, i’m really bad at raycasting so the raycasting part of the code provided is just from a tool in the toolbox so like i said if anyone has a better solution i’d be happy to hear it

I have decided to use the Fast cast module (FastCast: Redux - Roblox) by EtiTheSpirit since it seems more flexible and works better