Enemy AI Script returns to 0, 0, 0 top down 2D

I have a script that has been working up to a recent point after I restarted my computer. The script is meant to make an enemy follow the player in a basic way but also determine what the player is by tag. It just out of the blue stopped working and i was wondering if anyone knew a way i could fix it…

using UnityEngine;
using System.Collections;

public class AiZ : MonoBehaviour {
	public Transform target;
	public float speed = 2f;

	void Start ()
		target = GameObject.FindWithTag ("Player").transform;

	void Update ()
		transform.position = Vector2.MoveTowards(transform.position, target.position, speed * Time.deltaTime);

thanks in advance

Watch out, you are assigning a Vector2 to a Vector3 (transform.position = Vector2.MoveTowards(transform.position, target.position, speed * Time.deltaTime)), as such, the z component is reset to 0.0f.

Then, for x and y, it should work. Are you sure you have a GameObject tagged as ‘Player’ ? Check in runtime the ‘Target’ member of your class and look for errors (Null references) is the Console.