Not spawning gameObjects at certain angles

I’ve made a shotgun script which spawns pellet prefabs on a button click as follows:

var spreadFactor = 4;
					var pelletSpeed = 50;
					var pelletCount = 100;
					fireRate = 1;
					clipSize = 8;
					if(Input.GetMouseButtonDown(0) && !firing && ammo != 0 && !isReloading && !fireCool){
						firing = true;
						fireCool = true;
			          	var pellet : Rigidbody;
        				for(var i = 0; i<pelletCount; i++){
            				var pelletRot = transform.rotation;
            				pelletRot.x += Random.Range(-spreadFactor, spreadFactor);
            				pelletRot.y += Random.Range(-spreadFactor, spreadFactor);
            				pellet = Instantiate(bullet, transform.position, pelletRot);
            				pellet.velocity = transform.forward*pelletSpeed;
        				}
			          	ammo -= 1;
			          	AmmoText.text = "Ammo Left: " + ammo.ToString();
			          	fireDelay(fireRate);
					}

I know the code works because upon clicking the pellets do spawn.

A screenshot of my scene is below.

As you can see it is very simple and there are no stray objects around. However, when I fire in a specific direction/angle (specifically towards about 45º anticlockwise), the pellets refuse to instantiate in there and spawn outside of that area instead. It becomes impossible to shoot anything inside of that area.

Why does this happen?

If you shoot in 3D, watch this video (Shooting with Raycasts - Unity Tutorial - YouTube)
and if you shooting in unity use my script;

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour
{
public GameObject star;
public bool canShoot = true;
public bool goingRight;
public bool goingLeft;
public Transform rightTransform;
public Transform leftTransform;
public float fireRate;

private float nextTimeToFire;

    void Start ()
{
	isGround = false;
}

void Update ()
{
    x = Input.getAxisRaw ("Horizontal");

	if (x > 0.1f)
	{
		goingRight = true;
		goingLeft = false;
	}

	if (x < -0.1f)
	{
		goingRight = false;
		goingLeft = true;
	}

	if (Input.GetKey(KeyCode.S) && Time.time >= nextTimeToFire)
	{
		Shoot ();
	}
}
	
public void Shoot ()
{
	nextTimeToFire = Time.time + 1f / fireRate;

	if (canShoot == true)
	{
		if (goingRight == true)
		{
			Instantiate (star, rightTransform.position, Quaternion.identity);
		}

		if (goingLeft == true)
		{
			Instantiate (star, leftTransform.position, Quaternion.identity);
		}
	}	
}

void OnCollisionEnter2D (Collision2D other)
{
	if (other.transform.tag == "Ground")
	{
		isGround = true;
	}
}

void OnCollisionStay2D (Collision2D other)
{
	if (other.transform.tag == "Ground")
	{
		isGround = true;
	}
}

void OnCollisionExit2D (Collision2D other)
{
	if (other.transform.tag == "Ground")
	{
		isGround = false;
	}
}

}