How do I set a parent and change the position of an object?

using UnityEngine;
using System.Collections;

public class Car : MonoBehaviour {

	public Transform playerController;
	public Transform ufoVehicle;


	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown (KeyCode.E)) {
			playerController.transform.parent = ufoVehicle.transform;
			playerController.transform.parent.position = ufoVehicle.transform.position;
		}
	}
}

What I want to do is change my character’s position and set it to a parent of a UFO Vehicle I created, so I can make a vehicle that can drive.

Try setting localposition to zero after parenting…

if (Input.GetKeyDown (KeyCode.E)) {
playerController.transform.position = ufoVehicle.transform.position;
playerController.transform.setParent(ufoVehicle.transfom)

//sets location within the parent, change this to make it all line up.
playerController.transform.localPosition = Vector3.zero;
}

this should work to some extent how you want it.