Raycast returning void

Hi guys,

Currently, I have a function that is designed to shoot rays out of every direction of a part in order to check for adjacent parts. These directions are defined in the following dictionary:

local directionsToCheck = {
	top = Vector3.new(0, 8, 0);
	bottom = Vector3.new(0, -8, 0);
	left = Vector3.new(-8, 0, 0);
	right = Vector3.new(8, 0, 0);
	front = Vector3.new(0, 0, -8);
	back = Vector3.new(0, 0, 8);
}

The origin part is 8x8x8, as is every block it is checking for. This is how I’ve decided the length for the rays.

The function uses a whitelist (based on a folder of parts) to see what it is allowed to hit. For some reason, when a ray is casted from below the block (bottom), it is returning void. This, in turn, causes the rest of my script to believe there’s nothing there and it proceeds accordingly. What’s strange is that it detects the blocks in every other direction.

This is the code that creates a table based on what blocks exist in a folder.

local spawnedBlocks = {}
	for i, v in pairs(workspace.spawnedBlocks:GetDescendants()) do
		if v:IsA("BasePart") then
			spawnedBlocks[i] = v
		end
	end

In the past, I had a condition that avoided putting the origin block in the whitelist so the ray wouldn’t hit itself, but that caused a problem with everything else and it’s been working fine without.

This is the loop that casts the rays:

for direction, vector in pairs(directionsToCheck) do
	local raycastResult = workspace:Raycast(block.Position, vector, raycastParams)
	if raycastResult == nil then
		clearDirections[direction] = block.Position + vector
	elseif raycastResult then
		print("CheckAdjacentBlocks(): raycast hit '" .. raycastResult.Instance:GetFullName() .. "' at position " .. tostring(raycastResult.Instance.Position) .. " headed in direction '" .. direction .. "'.")
	end
end

I’ve verified that the spawnedBlocks table actually has the instance for the bottom block available via the debugger. I can’t for the life of me understand why I keep getting void as a result. Does anyone know of some cases in which this might occur and why it occurs, therefore I may attempt to figure this out myself? I’ll take any and all help I can get.

Also, if it helps to provide some context or anything, I originally searched for help with this code on the following thread for a different reason, but you can see how the conversation has evolved.

Many thanks!