Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how would you go about making a ray go straight fowards, depending on where the mouse is?

Asked by
letris 0
6 years ago
Edited 6 years ago

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)

Answer this question