Help with Trigger

Basically what I’m trying to do is have it so that when my Player enters the trigger(OnTriggerEnter) to have the Main Camera to follow the player along on the X axis.

I originally had two scripts made, one for the trigger so that if c.name == “Player” to active a function I had in another script attached to the Camera but I failed to as I’m still new to all C# and didn’t really know how. Plus I assumed there was to be an easier way all in the one script.

So currently this is what I have -

public Transform Player;
public GameObject camera;
	
	void OnTriggerEnter(Collider a)
	{	
		/*
		transform.position = new Vector3(Player.transform.
		position.x,transform.position.y,transform.
		position.z);
		*/
		
	}

I have it commented out right now.

On the camera, this could be CameraScript.cs:

public bool follow = false;
public Transform player;

void Update(){
  if(follow){
     Vector3 vec = transform.position
     vec.x = player.x;
     transform.position = vec;
  }
}

Then on the trigger box:

public CameraScript cam; // Drag cam into this.
void OnTriggerEnter()
{
    cam.follow = true;
}

Okay, my current code

Trigger - `using UnityEngine;
using System.Collections;

public class camtrigger : MonoBehaviour
{
public CameraScript cam;
void OnTriggerEnter()
{
cam.follow = true;
}
}`

And my camera follow - `using UnityEngine;
using System.Collections;

public class camfollow : MonoBehaviour

{
public bool follow = false;
public Transform Player;

void Update () 
{
	if(follow)
	{
		Vector3 vec = transform.position
		vec.x = Player.x;
		transform.position = vec;
	}
}

}`

Then on to the errors, like I could tell the code wasn’t right before I tried it but anyway.

unexpected symbol vec, the namespace camera script doesn’t exist, a few more in there. I still haven’t worked it out.