I believe what you’re looking for is a LookVector which is a property of CFrame.
It describes a unit vector in the direction the CFrame is facing.
local distance = 1000
local origin = game.Workspace.Camera
local direction = origin.LookVector * distance
local raycastresult = workspace:Raycast(origin,direction)