That usually means something is unsupported in the table you gave it or it might require an array but I don't see any of those problems in your code.
You can instead try the new raycasting API since you'd probably want to utilize newer and neater API here.
Here's what I recreated of your script with new API:
local part = script.Parent
local origin, direction = part.Position, Vector3.new(0,0,50)
local rayParams = RayParams.new()
rayParams.FilterType = Enum.RaycastFilterType.Blacklist
rayParams.FilterDescendantsInstances = {part}
while true do
local result = workspace:Raycast(origin, direction, rayParams)
if result then
print("Raycast")
else
print("No part found!")
end
wait(1)
end
Note that there is a difference in using this API and that is, the result will be nil if there is no instance found whereas the Ray.new() raycasting would return a position always even if no object was found. You also have to index the result like a dictionary in order to see what object was found, the position, normal, etc. (result.Instance, result.Normal, result.Position)