The two answers above are correct but its probably worth adding that Ray.new() is deprecated and LocalPlayer:GetMouse() has been superseded by UserInputService
Ray.new() IS NOT DEPRECTATED. The old methods of reading a raycast like findpartsonray() ARE DEPRECATED. You can still use Ray.new() for the new type of raycast(as long as it’s with the Ray.Origin etc)
Thanks for the correction, although there’s still not much use for Ray.new() I can find besides Ray:ClosestPoint() (which can still be achieved with WorldRoot:Raycast() btw), just generally would not recommend using it for typical raycasting purposes.