New RaycastParams not working?

I’m confused to why it returns nil 100% of the time, even though I am absolutely certain that it should hit.

-- [ Raycast ] --
local RAYCASTPAREMS = RaycastParams.new()
RAYCASTPAREMS.FilterType = Enum.RaycastFilterType.Blacklist
RAYCASTPAREMS.IgnoreWater = true

-- // FUNCTIONS \\ --

-- [ Supplementary ] --
function Raycast(Part, Length)
	local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
	local Head = Character:WaitForChild("Head")
	
	
	RAYCASTPAREMS.FilterDescendantsInstances = {Character}
	local Result = WORKSPACE:Raycast(Head.Position, (Head.Position - Part.Position).Unit * Length, RAYCASTPAREMS)
	print(Result)
	return Result
end

it is called here:

local RaycastResult = Raycast(game.Workspace.Part, 100)

Any ideas why its broken?

have you tried printing out the parameters to check the values at time of execution?

1 Like

:Raycast() will return nil if there is no object found from the raycast. If you want to simulate the result position just like the old raycasting then add the origin and direction.

1 Like

Sorry. I forgot to mark this as solved, the Unit was subtracted wrong, therefore going the opposite direction