Stefex is right you are only checking the ray one time and looping through the same result. Try dkevinb’s script or at least move the raycast into your loop: