Why is my bullet spread the same regardless of distance?
So, I've written a bullet spread script, but there's a problem with it. No matter the range, the bullet will offset the same amount, making it possible to miss at point blank which obviously is an issue.
Here's my script, any ideas how to fix it?
01 | local xOff = math.random(-spread * 100 , spread * 100 ) |
03 | local yOff = math.random(-spread * 100 , spread * 100 ) |
05 | local zOff = math.random(-spread * 100 , spread * 100 ) |
08 | local NewPos = mouse + Vector 3. new(xOff, yOff, zOff) |
09 | local ray = Ray.new(tool.firePart.CFrame.p, (NewPos - tool.firePart.CFrame.p).unit* 300 ) |
10 | local part, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList, false , true ) |