RayCast isn't working

I am trying to raycast for a laser but it is completely ignoring the parts and continues to go straight through them. I am brand new to raycasting and have been trying to follow developer articles so most of this code is from the developer roblox website.

local params = RaycastParams.new()
params.FilterDescendantsInstances = {Player,Start.Parent.Parent}
params.FilterType = Enum.RaycastFilterType.Blacklist
local unitRay = Camera:ScreenPointToRay(mousePos.x, mousePos.y)
local raycastResult = workspace:Raycast(unitRay.Origin, unitRay.Direction * 500, params)
if raycastResult then
	local hitPart = raycastResult.Instance
	if hitPart.Transparency ~= 0 and not hitPart.Parent.Name == "Ocean" then
		End = hitPart.Position
	end
end

There is no raycastResult, when I added a print line under if raycastResult then it never printed.

You could try Debugging | Roblox Creator Documentation to step through your code line by line and make sure all the variables are what you’d expect.

Also BTW the mouse already has a Mouse | Roblox Creator Documentation property you could use.

I’ve already debugged everything is the right variable that’s not the issue.

I don’t see much that could be a problem
maybe Start.Parent.Parent or Player is something like workspace by accident?
otherwise, idk what could be making that return nil

also, not hitPart.Parent.Name == "Ocean" should be not (hitPart.Parent.Name == "Ocean")

When it comes to RayCast I have completely ditched it’s function and instead I started using IsHovering on ClickDetectors instead, work’s the exact same way!