Sights script not working?

I have this script below that makes a weapon move from one object to another and increasing the zoom, it workes without the ‘+= Time.deltaTime * Speed’ part but when i add it, it comes up with errors, how can these be fixed so that i can move the weapon over time?

var eye : Transform;

var Speed = 5.0;

var norm : Transform;

function Update(){

if(Input.GetKeyDown(“v”)){

if(Camera.main.fieldOfView == 60){

transform.position = eye.position += Time.deltaTime * Speed;

Camera.main.fieldOfView = 20;

}else{

transform.position = norm.position += Time.deltaTime * Speed;

Camera.main.fieldOfView = 60;

}
}
}

You have a double assignment in a single instruction, and that’s not legal for the compiler.

transform.position = eye.position += Time.deltaTime * Speed;

In other words, you have a double “=” operator in the same line.

I’m not sure about what you are trying to do, but this should work for you:


eye.position += Time.deltaTime * Speed;
transform.position = eye.position;

instead of:

transform.position = eye.position += Time.deltaTime * Speed;

and:

norm.position += Time.deltaTime * Speed;
transform.position = norm.position;

instead of:

transform.position = norm.position += Time.deltaTime * Speed;