OP likely wants to see the ray while testing the project. Rays can come in different origins and directions.
@OP you can create a very thin part, position it at the origin of the ray. Have it look at the position, then offset it, because if you just position it at the origin of the ray it will be in the middle.
local r = Ray.new(origin, direction)
local _, position = workspace:FindPartOnRay(r)
local distance = (origin - position).Magnitude
local p = Instance.new("Part")
p.Anchored = true
p.CanCollide = false
p.Size = Vector3.new(0.1, 0.1, distance)
p.CFrame = lookAt(position, origin)*CFrame.new(0, 0, -distance/2)
-- for the lookAt() function, it is under CFrame.fromMatrix:
-- https://developer.roblox.com/en-us/api-reference/datatype/CFrame