expecting }, found ''.

expecting }, found ‘public’.

expecting EOF, found ‘}’.

What is wrong??? Nothing is wrong??? This script is correct!!! Why am I getting these errors???

function PickUpObject ()
{
	public var PickedUp = true;
 	
 	// Get the transform of the camera
	var object = gameObject.transform; 	
	// make it a child of the current object
	object.parent = Camera.main.transform; 
	// place it behind the current object
	object.localPosition = Vector3.forward * 5;
	
	rigidbody.useGravity = false;
	
	rigidbody.isKinematic = true;
}

function Update ()
{
	if (PickedUp == true)
	{
		if (Input.GetKeyUp ("e"))
		{
			PickedUp = false;
			
			object.parent = null;
			
			rigidbody.useGravity = true;
			
			rigidbody.isKinematic = true;
		}
	}
}

You can’t declare a public var inside a function. Move the “public var PickedUp = true;” outside the function block and the error goes away.

Another turns up however: “object” is not known in the Update() function, but this should be easy to rectify. :slight_smile: