I cant get my 2d shooting script to work?

Been trying to get a 2d shooting script to work the past few hours and it’s frustrating now. Could anyone point out what I need to change? First time I work with 2d in Unity. Thanks in advance!

This is attached to the Player. It just spawns infront of it without doing anything. Any ideas? Thanks again.

#pragma strict

var BubblePrefab : Rigidbody;
var BubbleSpawn : Transform;
var spawnDistance : float = 10.0f;
function Start () {

}

function Update () {

if (Input.GetKeyDown(KeyCode.Space)) {

    
 
   
    GameObject.Instantiate(BubblePrefab, BubbleSpawn.position, BubbleSpawn.rotation);
     transform.position += Time.deltaTime * 5 * transform.forward;
}
}

var GA : GameObject = Instantiate(BubblePrefab, BubbleSpawn.position, BubbleSpawn.rotation) as GameObject;
GA.transform.position += Time.deltaTime * 5 * transform.forward;

you should add a script to your bubble prefab, that moves it forwards by itself.
move this line… into that scripts update function

transform.position += Time.deltaTime * 5 * transform.forward;

also get rid of the 5 and make it a variable, so you can easily tweak the speed.

Now whenever you hit space… it will spawn a new bubble… and the bubble will move itself forwards.
and you can spawn as many bubbles as you like, and they will all take care of themselves.