Im trying to use RayCasting for the fist time in a while, and I could not find out what was going on. So I checked some of my numbers and It seems my problem does not lie with the ray itself but the actual numbers themselves
I initially tried to use a beam to test if I was getting my numbers correct.
GunFired.OnServerEvent:Connect(function(plr, MouseLV)
local EndPoint = MouseLV - Origin
local PreCalcEndPoint = EndPoint
local BeamAchor = Instance.new("Part")
BeamAchor.CanCollide = true
BeamAchor.Transparency = 0
BeamAchor.Anchored = false
BeamAchor.Position = Tool.MuzzelFlash.Position
local OuterPart = Instance.new("Part", workspace)
OuterPart.CanCollide = true
OuterPart.Transparency = 0
OuterPart.Anchored = false
OuterPart.Position = PreCalcEndPoint
local AttachmentO = Instance.new("Attachment", BeamAchor)
Beam.Attachment0 = AttachmentO
local AttachmentI = Instance.new("Attachment", OuterPart)
Beam.Attachment1 = AttachmentI
end)
Even though the beam does not work (I don't care all that much), the outer part shows me that for whatever reason I'm not retrieving entirely the correct position, and I can't tell why. (Also keep in mind this is not my entire code, only the relevant parts of it)

1 comment
What exactly are you trying to make? Raycast from the camera to the mouse position?