Raycasting issues

Hello,

I am working on commissioning some blasters for someone and I have run into an interesting issue. The video attached is of my hit detection system, which uses raycasting that starts from the muzzle of the gun and ends at the mouse’s position. It sends the bullet there no problem but for some reason the singe mark and sparks appear in a totally different area. Notice how those parts appear way below the actual impact point but if I make the mouse cursor ignore everything in workspace, the ray detects the correct position.

Any help in this matter is appreciated.

IssueReport

We are going to need a sample of your script for placing those parts down to be able to give you an answer. Please label the components of the script so it’s easier to read.

Update: I figured it out. Turns out there was some issue with the mouse being too close to the target so instead of using mouse.hit, I made a vector of

CFrame.new(position of gun muzzle, mouse.hit).LookVector*5000

and this fixed the issue