Anyone know what's wrong with my script?

So I am finally starting to get the hang of scripting in Unity. However, I’m still not perfect and I have recently made a script that dosen’t work and I can’t seem to find the flaw.
Here’s the script :
var Area1 : Transform;
var Area2 : Transform;
var MovePls : boolean = true;
var CurrentArea = 1;

function Start () {

gameObject.transform.position = Area1.transform.position;

}

function WaitSeconds () {
	var randomWait = Random.Range(0, 6);
	yield WaitForSeconds(randomWait);
	MovePls = true; 
}

function Update () {
	if (MovePls)
		if (CurrentArea == 1)
			gameObject.transform.position = Area2.transform.position;
			CurrentArea = 2;
			
		if (CurrentArea == 2)
			gameObject.transform.position = Area1.transform.position;
			CurrentArea = 1;
}

Basically what it’s supposed to do is to take the object it’s attached to and first teleport it to “Area 1”, then wait randomly between 0 to 6 seconds and teleport it to “Area2”, then once again wait 0 to 6 seconds and teleport it back to*“Area 1”*, cycle repeats. However, the script dosen’t seem to work properly and I can’t find out what’s wrong since I’m still a noob.

Can someone experienced tell me what’s wrong with the script?

The javascript comiler/interpretor does not care about indentation but cares about new lines.

if(condition)
   statement

only works when statement is on one line

This is why in your current code you have the following code

if (CurrentArea == 1)             
     gameObject.transform.position = Area2.transform.position;
     CurrentArea = 2;
if (CurrentArea == 2)
     gameObject.transform.position = Area1.transform.position;
     CurrentArea = 1;

which the computer sees as

 if (CurrentArea == 1){          
         gameObject.transform.position = Area2.transform.position;
 }
 CurrentArea = 2;
 if (CurrentArea == 2){          
         gameObject.transform.position = Area2.transform.position;
 }
 CurrentArea = 1;

to fix this enclose blocks of code (longer than one line) following if/else statements in brackets {}. Also you need to use if/else here otherwise the first part sets CurrentArea=2 then the check in the second part if(CurrentArea==2) is true and the second block would be immediately run. i.e.

if (CurrentArea == 1) {           
     gameObject.transform.position = Area2.transform.position;
     CurrentArea = 2;
}  
else if (CurrentArea == 2) {           
     gameObject.transform.position = Area1.transform.position;
     CurrentArea = 1;
}