Follow only on Z axis?

How do I get the following code to only follow on 1 axis?

using UnityEngine;
using System.Collections;

public class Follow : MonoBehaviour
public GameObject Subject;
private Vector3 _offset;

void Start ()
       _offset = Subject.transform.position - transform.position;

void Update ()
	transform.position = Subject.transform.position - _offset;


Are you trying to get an enemy to follow your character, but only on the z axis?

If using Javascript isn’t a problem:

Subject : Transform; 
       function Update(){
           transform.position.z = Subject.position.z;}

This will just transport the object its attached to instantly to its location every frame.