Instantiate rotation not working

Hi.
My game has a part of a script i am using to instantiate bullets, but the rotation argument on the Instantiate is not working like I want it to.

var y : float;

function Update () {
    y = transform.eulerAngles.y;
    
    if(clicked){
        Instantiate(bullet, transform.position,Quaternion.EulerAngles(0, y, 0));
    }
}

The bullet ends up shooting off into some random direction, anything but what I want. Thank you!

exchange Quaternion.EulerAngles(0,y,0) for transform.rotation.

Hope this helps.