I want to move first person controller only in the forward direction freezing any other direction

I am trying to move my first person controller only in the forward direction.Thats easy i know.I have scripted the fpc to move in the forward direction only but the problem is i need to change its direction.That is i want it to move left and right only .The normal fpc controller moves forward but when i change its direction it starts moving in that direction and moves out of the terrain.Is there any way to change the orientation of the fpc but it should continue moving in the forward direction.
My moving forward script is :

function Update() {
transform.Translate(Vector3.forward * Time.deltaTime*4);


If I’m understanding your question correctly, add the Space.World parameter to your Translate so your Translate becomes.

 transform.Translate(Vector3.forward * Time.deltaTime*4, Space.World);