So I posted this earlier and I thought I had it. However, I found that the closer the target is, the more spread out the bullets will be. Is there an easy way to make the spread consistent no matter where the mouse is aimed on the screen?
local x = math.random(-3, 3)/math.random(10) local y = math.random(-3, 3)/math.random(10) local z = math.random(-3, 3)/math.random(10) local spread = Vector3.new(x, y, z) local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p + spread - tool.Handle.CFrame.p).unit * 300)
local value = 10 local Spread = CFrame.Angles(math.rad(math.random(-value, value)/10), math.rad(math.random(-value, value)/10), math.rad(math.random(-value, value)/10)) local Ray = Ray.new(tool.Handle.CFrame.p, (CFrame.new(tool.Handle.CFrame.p, mouse.Hit.p) * Spread).lookVector.unit * 300) local Hit, Pos, Normal = workspace:FindPartOnRayWithIgnoreList(Ray, Ray_Ignore)