Why do I keep getting an error with table.insert?

this is the error:
image

here is the line causing the error:

	table.insert(neighbors, workspace:FindPartOnRay(Ray.new(currentBlock.Position, Vector3.new(-1, 0, 0))))

I can’t figure out what is wrong, it’s using only the 2 arguments in the function…

I assume that returns more than one argument

I would like to add that if the function does and NEEDS to return more than two arguments, you could also make it return a table/array instead.

1 Like

Switching to workspace:Raycast will fix the issue for you, but you will need to change some parts of your code, like result.Instance.