I’m aware that there are several other similar topics. However, they all include using the mouse positions, where I’m trying to make it for a turret on a plane. This is the current code I got:
bullet.CFrame = turret.CFrame
This is the formula I’m using:
local SpreadValue = 10
local Spread = CFrame.Angles(math.rad(math.random(-SpreadValue , SpreadValue )/10), math.rad(math.random(-SpreadValue , SpreadValue )/10), math.rad(math.random(-SpreadValue , SpreadValue )/10))
By getting a random number -10 through 10 and then dividing that by 10, your maximum spread will be 1 degree, which is hardly perceptible, especially when in most cases it is much less that then. Try setting SpreadValue to a higher number, such as 50, so the bullet can be offset by up to 5 degrees in each direction.
That will just have the bullets move in a stuck direction. Making it relative to the Turret makes the bullets fire in the direction the plane/turret is facing.
Thats why you orient the bullets based on the turrets position and a randomly generated spread, and then just move the bullet relative to the bullet’s current orientation. The bullet will still appear to be fired from the turret.