Gun Firing help?

Hi huys,
I followed a guide on here about how to make a gun fire, and it gave me this javascript code:

var prefabBullet = gameObject;
function Update() { if(Input.GetButton("Fire1")){
bullet = Instantiate(prefabBullet; gameObject.Find("spawn").transform.position;
bullet.rigidbody.AddForce(transform.forward * Speed);

I have a prefab of a square gameObject named prefabBullet, but i keep getting an error saying that the code has an “unexpected token ‘prefabBullet’”. I’m not quite sure what it wrong here, so any help would be much appreciated thanks.

If that is the entire script than you need to have a variable for speed and set it to an int. I would suggest var speed = 5; and if it is not spawning in that is because the script is attempting to pull from your assets. So you have to make a gameobject call it spawn and then drag that gameobject into your assets folder.

Did you make sure to check that your prefabBullet has an object in it? Check in the inspector and if the prefabBullet is empty, drag the gameobject that you want in there. This may or may not be the problem.