Problem with raycasting

I don’t know why but i seem to be having a problem with ray-casting, whats the problem with this code:

using UnityEngine;
using System.Collections;

public class BOT : MonoBehaviour {
	
	public GameObject Enemy;
	public GameObject EnemyBarrelEnd;
	//public GameObject gun;
	public int Health = 100;
	public float Movecount;
	// Update is called once per frame
	public float RandomY;
	public bool boolean = true;
	public GameObject LaserBarrelEnd;
	RaycastHit hit; 
	private float Distance;
	private GameObject Soldier;
	void Start()
	
	{
	
	
	
	}
	void Update () 

	{
		Debug.DrawLine (transform.position, hit.point, Color.cyan);
		//Distance=Vector3.Distance(Enemy,Soldier);

		Ray MyRay = new Ray(LaserBarrelEnd.transform.position, Vector3.forward);
		if(Physics.Raycast(MyRay, out hit,100)){
			if (hit.collider.gameObject.tag == "soldier")
			{
				Shooting();
			}
		}

		


		if (boolean)

		{
			Movecount=Random.Range(3f,5f);
			boolean = false;
		}

		if (Health > 0)

		{ 
			RandomMove();
		}

	}

	void RandomMove()
	{
		Movecount=Movecount-Time.deltaTime;

		if (Movecount > 0)
			{
				Enemy.transform.position = Vector3.Lerp (Enemy.transform.position,EnemyBarrelEnd.transform.position,1f);
				animation.Play("soldierRun");
			}
		if (Movecount<=0)
		{ 
			RandomTurn();
		}

		
	}

	void RandomTurn()
	
	{
		RandomY =Random.Range(45f,360f);
		Enemy.transform.Rotate(0,RandomY,0);
		Movecount=Random.Range(3f,5f);

	}
 

		void Shooting()
		{

			Debug.Log("I see You");

		}


}

It is okay… In my script is no problem…

using UnityEngine;
using System.Collections;

public class HIT : MonoBehaviour {
	
	public GameObject Enemy;
	public GameObject EnemyBarrelEnd;
	//public GameObject gun;
	public int Health = 100;
	public float Movecount;
	// Update is called once per frame
	public float RandomY;
	public bool boolean = true;
	public GameObject LaserBarrelEnd;
	RaycastHit hit; 
	private float Distance;
	private GameObject Soldier;
	void Start()
		
	{
		
		
		
	}
	void Update () 
		
	{
		Debug.DrawLine (transform.position, hit.point, Color.cyan);
		//Distance=Vector3.Distance(Enemy,Soldier);
		
		Ray MyRay = new Ray(LaserBarrelEnd.transform.position, Vector3.forward);
		if(Physics.Raycast(MyRay, out hit,100)){
			if (hit.collider.gameObject.tag == "soldier")
			{
				Shooting();
			}
		}
		
		
		
		
		if (boolean)
			
		{
			Movecount=Random.Range(3f,5f);
			boolean = false;
		}
		
		if (Health > 0)
			
		{ 
			RandomMove();
		}
		
	}
	
	void RandomMove()
	{
		Movecount=Movecount-Time.deltaTime;
		
		if (Movecount > 0)
		{
			Enemy.transform.position = Vector3.Lerp (Enemy.transform.position,EnemyBarrelEnd.transform.position,1f);
			animation.Play("soldierRun");
		}
		if (Movecount<=0)
		{ 
			RandomTurn();
		}
		
		
	}
	
	void RandomTurn()
		
	{
		RandomY =Random.Range(45f,360f);
		Enemy.transform.Rotate(0,RandomY,0);
		Movecount=Random.Range(3f,5f);
		
	}
	
	
	void Shooting()
	{
		
		Debug.Log("I see You");
		
	}
	
	
}

It will point in the direction of the character if you use transform.forward rather than Vector3.forward. The debug statement is drawing from the character’s feet towards the last point hit by the ray (on the former frame) - if you want to draw the line from the barrel you need to use that position instead.