C# Simple turret script problem


I have the simplest Turret code which doesn’t work. It fires projectiles in Z direction (?!) When player is at the positive x positin of the turret the turret shoots upwards in Z, otherwise downwards. It is always facing the player however.
What is wrong?

I attached this code to a simple cube. And the target is a moving player.

using UnityEngine;
using System.Collections;

public class TurretScript : MonoBehaviour {

public GameObject projectile;
public Transform target;
	void Start(){

	void Update(){
	transform.rotation = Quaternion.LookRotation (target.position - transform.position);
	// Shoot and repeat
	void RepeatShooting () {
		InvokeRepeating ("LaunchProjectile", 2, 0.3f);

	public void LaunchProjectile(){
		//Vector3 projectileStart = new Vector3(
		Instantiate (projectile, transform.position, transform.rotation);

Try making a spawn at the end of the barrel of the turret and using something like this:

Instantiate(Projectile, Spawn.transform.position, Spawn.transform.rotation);

Also use something like this:

 Vector3 vSpeedDelta = transform.forward * (Time.deltaTime * ProjectileSpeed);
        transform.position += (vSpeedDelta);

Put this in the update of a projectile script and attach that new script to the projectile itself. This should always fire straight assuming the projectile spawn has its forward axis points forward of the barrel.