so i have been trying multiple methods to get a ray to go straight from a barrel of a gun, going in the direction of the gun, but the only problem is that it hits the 3D space the mouse is over, so it would usually just go straight to the ground, how would i get a ray to go straight, but it goes in the direction of the mouse? here is what i have at the moment;
local ray = Ray.new(tool.Barrel.CFrame.p,(player:GetMouse().Hit.p - tool.Barrel.CFrame.p).unit*300)