Need help detecting if RaycastResult.Instance == nil

Hello! How can I successfully conquer this error:
image
I am trying to convert FindPartOnRayWithIgnoreList to Raycast as seen in this ModuleScript:

local module = {}

function module.new(startPosition, startDirection)
	local maxDistance = startDirection.magnitude
	local direction = startDirection.unit
	local lastPosition = startPosition
	local distance = 0
	local ignore = {}

	local ray = Ray.new(lastPosition, direction * (maxDistance - distance))
	local DefaultParams = RaycastParams.new()
	DefaultParams.IgnoreWater = true
	DefaultParams.FilterType = Enum.RaycastFilterType.Blacklist
	DefaultParams.FilterDescendantsInstances = ignore
	local Result = workspace:Raycast(ray.Origin, ray.Direction, DefaultParams)

	if Result.Instance then -- The error happens here
		if not Result.Instance.CanCollide then
			table.insert(ignore, Result.Instance)
		end
	end
	distance = (startPosition - Result.Position).magnitude
	lastPosition = Result.Position
	return Result.Instance, Result.Position, Result.Normal
end

return module

If you can help, please let me know. Thanks! WE

To

	if Result then -- The error happens here

It’s either a result with an instance (BasePart also includes terrain) or no result at all.