so i am using raycasting to script a gun i just started on the gun and i want it to check if a player clicked then the ray goes. The code is this,
local maxdistance = 500
script.Parent.Parent.Equipped:Connect(function(mouse)
local ray = Ray.new(script.Parent.Parent.barrel,i don't know what to put here i don't know how to have the orientation be where the mouse is)
end)
so yeah how do you get the orientation to put the ray at? (i need it to go to the mouse)

4 comments
what does the .unit at the end of line 12 mean?
That gets the direction of the vector going from barrel -> myMouse.
at line 12 it has an error when i click it, it says "this mouse is no longer active"
also is it suppose to be in a script, or a local script?