Mouse position problem

I’ve been trying to make a gun. I have been using camera:ScreenPointToRay() to get the ray for the bullet however it’s having some problems. Here’s my code:

local unitRay = cam:ScreenPointToRay(mouse.X + math.random(-accuracy, accuracy), mouse.Y + math.random(-accuracy, accuracy))

As you can see with the video, it seems to think the mouse is somewhere it isn’t… please help!


If you need more info let me know

nevermind, I seem to have done something wrong…