How to check if a raycast is Nil?

Raycast wont return a position when it doesn’t hit anything,
I have a raycast gun so if a player aims to the sky no position is returned. I still want the direction the player shot in so i can make a visual beam effect appear, however, when i do cast the ray into the sky, the script stops at the ray position not existing and doesn’t let me check if it exists or not

image

tldr how do i check if a ray didn’t hit anything?

if Raycast then
    -- Code here
end

To explain a little bit “nil” is essentially “false” in your code.

Code Block Example: (Mark Me as an Solution Please.)

if RaycastResult then
Do whatever here if it exists.
else - it doesn’t exist
Do whatever here if it doesn’t exist.