expecting EOF, found 'else'.

Hey folks!

I’am having a problem with the following script:

var car : Transform;
var player : Transform;
var exitPoint : Transform;
var doorTriggerLeft : Transform;
var isPlayerVisible : boolean;


function Update()
{
var screenRay : Ray= Camera.main.ScreenPointToRay(Input.mousePosition);
var rayhit : RaycastHit;
if(Physics.Raycast(screenRay,  rayhit));
if(rayhit.collider.tag == "doorTriggerLeft");
}
Debug.Log("Driving");
{
player.gameObject.SetActiveRecursively(false);
player.gameObject.active = false;
player.parent = exitPoint.transform;
player.transform.localPosition = Vector3(-1.5,0,0);

exitPoint.parent = car.transform;
exitPoint.transform.localPosition = Vector3(-0.3,1.5,-0.65);

GameObject.Find("Car").GetComponent("CarControl").enabled=true;

}
else
{
if (Input.GetKeyUp("r")) 
{
Debug.Log("Walking");

player.gameObject.SetActiveRecursively(true);
player.gameObject.active = true;

player.transform.parent = null;

exitPoint.parent = car.transform;
GameObject.Find("Car").GetComponent("CarControl").enabled=false;
}
}
}

function OnTriggerEnter(Player : Collider)
{
Debug.Log("Trigger Enter");
isPlayerVisible = true;
}

function OnTriggerExit(Player : Collider)
{
Debug.Log("Trigger Exit");
isPlayerVisible = false;
}
}

unity gives me the following error:

Assets/Standard Assets/Scripts/Car entering  exiting.js(28,1): BCE0044: expecting EOF, found 'else'.

could you maybe help me with that and show me where i can find the error? i know EOF means end of field and usually he excepting or missing a { or } but in my opinion everything is right :confused:

Your brackets and your if statements are all wrong

lines 12 and 13 probably shouldn’t have semicolons
line 14 ends the update block
line 16 opens an orphan block
…etc
Indent your blocks, code becomes 100% easier to read