AI patrolling script

Hi, I have this script, and I was trying to make it rotate 180 grades once he gets to one patrol point,but I’m lost, I hope you can help me, thanks.

public class POLICEscript : MonoBehaviour {
	public Transform[] patrol;
	private int Currentpoint;
	public float moveSpeed;
		
	void Start()
		{
			transform.position = patrol [0].position;
			Currentpoint = 0;
		}
	void Update()
		{
			if(transform.position == patrol[Currentpoint].position)
				{
					Currentpoint++;
				}

			if(Currentpoint >= patrol.Length)
				{
					Currentpoint = 0;
				}

			transform.position = Vector3.MoveTowards (transform.position, patrol [Currentpoint].position, moveSpeed * Time.deltaTime);			
		}

First of all, I would suggest using a Vector3 as your patrol coordinates, no reason to use a transform, is there? Anyway, since an object’s position will almost certainly never be exactly the same as another one’s if it hasn’t been moved there by setting the values by hand, you will be better off checking the Vector3.distance between the character and his next patrol position. Once he gets within a certain distance, like 0.5f units, he has has more or less reached it and can continue on to the next. The threshold could of course be made much smaller, it’s worth experimenting. Just don’t make it too small (0.00xxx) or it will never be reached.

You just have to modify the line like this:

  if(Vector3.Distance(transform.position, patrol[Currentpoint]position) < 0.5f) {
        Currentpoint++;
  }

As for rotating, there are several ways to do it, one is explained here :
http://blog.anthonybaker.me/2010/09/rotating-your-character-in-unity3d.html