Why is this not running?

So I noticed that when I run the If statement to see if the there is a humanoid in the targets parent.
This line will not run.

It runs if there isnt a hum but it wont run if there is one.
Why is this happening??

		-- detect for a player
		local origin = char.PrimaryPart.Position
		local root = char.PrimaryPart
		
		-- where the ray fires to
		local rayDirection = origin + root.CFrame.LookVector * 15
		
		local part = Instance.new('Part')
		part.Parent = workspace
		part.Size = Vector3.new(1,1,1)
		part.Anchored = true
		part.Position = rayDirection
		game:GetService('Debris'):AddItem(part,3)
		
		
		
		-- send the raycast
		local raycastResult = workspace:Raycast(origin, rayDirection)
		
		if raycastResult then
			print('Casted')
			local target = raycastResult.Instance
			
			if target.Parent:FindFirstChild('Humanoid') then -- THIS IS NOT RUNNING WHYYYYY
				print('There is a hum')
				
				local hitChar = target.Parent
				local Hithum = hitChar.Humanoid
				local Hitroot = hitChar.PrimaryPart
				
				Hitroot.CFrame = CFrame.new(Hitroot.Position,char.PrimaryPart.Position)
				
				
				local charCframeToGoTo = Hitroot.CFrame * CFrame.new(0,0,10)
				char.PrimaryPart.CFrame = charCframeToGoTo
				
				
				
			else
				print('No hum')

			end
		end

I just realized that now its not really even working. Why is this happening?
Also it mostly doesn’t work if it is in a certain direction

it doesn’t print “There is a hum” or “No hum”? but prints “Casted”?

Can I see a video of you hitting a character and the console outputs?

You could change FindFirstChild to FindFirstChildOfClass, because you might have named a Humanoid smth different.

You forgot the raycast params.

It does print casted and no hum. But it does not print There is a hum

Oh. This is the second time I have used raycasts how would I do this?
I can find A tutorial if you want

you create a new params with RaycastParams.new().