Raycast returns nil

So I made a raycast script, and it just says that the raycast is nil. Nothing is helping. Does anyone know the solution to this

while wait() do
	local Params = RaycastParams.new()
	local orig = script.Parent.Position
	Params.IgnoreWater = true
	Params.FilterType = Enum.RaycastFilterType.Blacklist
	Params.FilterDescendantsInstances = {script.Parent}
	
	local raynew = workspace:Raycast(script.Parent.Position, (Vector3.new(40,40,40) - script.Parent.Position).Unit * 40, Params)
	
	if raynew then
		if raynew.Instance then
			print(raynew.Instance.Name)
		end
	end
end

I’m assuming this is in response to my post on the other topic

I think I didn’t explain very clearly (sorry I’m bad with conciseness), but here you’re casting a ray from script.Parent.Position, towards the coordinates 40, 40, 40 with a length of 40. Is there a part at 40, 40, 40? If so, the way likely wouldn’t be long enough to intersect it unless this part is relatively large, but there are a lot of things that could be the case here. Could you show what you’re trying to do?

I’m trying to make the part raycast everything in its range. And then print the instances.

Ah okay we don’t have spherecasting so it’s unlikely that that’s what you’re looking for. Maybe GetPartBoundsInRadius is a better option

The result will be nil when no objects are intersecting the ray.

Considering you’re saying you want to print all the objects that intersect from point A to point B, you might want to look into either of the spatial query functions - raycasting only returns 1 result at most.