Fixing bullet spread

Hi, I’ve been trying to change how my script does bullet spread for a good while now but every time I change it the script just breaks, could anyone help with this?
I’m trying to make the spread more of a circular pattern, but random of course.

local direction = (CFrame.new(org,mousePos))
    local verticalSpread = config.Spread
    local horizontalSpread = config.Spread
    if config.Spread.Vertical then
          verticalSpread = config.Spread.Vertical
    end
    if config.Spread.Horizontal then
          horizontalSpread = config.Spread.Horizontal
    end
     local rng = Random.new()
     verticalSpread = rng:NextNumber(-verticalSpread,verticalSpread/(10*spreadMult))
     horizontalSpread = rng:NextNumber(-horizontalSpread,horizontalSpread/(10*spreadMult))

     verticalSpread = math.rad(verticalSpread)
     horizontalSpread = math.rad(horizontalSpread)
     direction = direction*CFrame.Angles(verticalSpread,horizontalSpread,0)
     direction = direction.LookVector
     direction = direction*velocity

Thanks in advance

I think this is the problem, it makes having positive spread easier or harder than having negative spread depending on spreadMult.
I think if you just move /(10*spreadMult) completely outside the parentheses, it will make it more balanced.

2 Likes

I’m pretty sure that made it better, thank you; But would you have an idea to make it even more circular?

maybe increase the number???

The pattern itself isn’t circular, for example when I fire a shotgun with 12 bullets they don’t go randomly in a circle but just to the side most of the time.

I’m trying to make the bullets spread out in a circle starting from the middle of the crosshair

https://gyazo.com/342f06751029e9d65a07d695af679317