Help with EOF errors

Hi I am writing a game and am trying to add cars but I keep getting this error:
BCE0044: expecting EOF, found }
Does anybody now of a solution to this problem?
Cheers Max
BTW
The whole code looks like this:

var enterDistence = 10;
//Boolean
static var playerInVehicle = false;
private var inRange = false;
//Transforms
var Char : GameObject;

Char = gameObject.Find("Character");

var player : Vector3 = Char.transform.position;
	var distence : Vector3 = player - transform.position;
	
	if (distence.magnitude < enterDistence)
	{
		inRange = true;
	}
	else if (distence.magnitude > enterDistence)
	{
		inRange = false;		
	}
	
	if (inRange == true)
	{
		if (Input.GetKeyUp("return"))
		{
			if (Get_In_Vehicle.playerInVehicle == true)
			{
				Get_In_Vehicle.playerInVehicle = false;
				gameObject.GetComponent(Car_Movement).enabled = false;
				Char.transform.parent = null;
				Char.active = true;
				gameObject.Find("ShaoKahn").SetActiveRecursively (true);
				Camera.main.GetComponent(SmoothFollow).target = Char.transform;
				Camera.main.GetComponent(SmoothFollow).distance = 15;
				Camera.main.GetComponent(SmoothFollow).height = 5;
				Char.transform.position.y += 10;
			}
			else if (Get_In_Vehicle.playerInVehicle == false)
			{
				Get_In_Vehicle.playerInVehicle = true;
				gameObject.GetComponent(Car_Movement).enabled = true;
				Char.transform.parent = gameObject.transform;
				Char.active = false;
				gameObject.Find("ShaoKahn").SetActiveRecursively (false);
				Camera.main.GetComponent(SmoothFollow).target = gameObject.transform;
				Camera.main.GetComponent(SmoothFollow).distance = 25;
				Camera.main.GetComponent(SmoothFollow).height = 10;
			}			
		}
	}
}

You have an extra } at the end.

1 Answer

1

The error is an indication of what it says. You have one too many ‘}’ in the file. But deleting this ‘}’ is not the right solution. In reading this code, it appears that all the code beyond line 8 should be in the Update() function. That is line 9 should be:

function Update() {

This will create an opening bracket for the closing bracket on line 51. Also I think line 8 should be:

private var Char; 

Then below that:

function Start() {
    Char = gameObject.Find("Character");
}

Thanks that worked