Player jumping into object

Hi, I have search unity anwers for different ways to implement that the player can jump into objects and control them (like GTA with the cars).
I’m trying to parent the player to the car, but don’t know if I’m on the right way.
can someone give me some directions?
here is the code, I put this on a trigger close to the object:

using UnityEngine;
using System.Collections;

public class observtrigger : MonoBehaviour {
	
public Transform player = player;
public Transform observer = observer;
//public Rigidbody observer;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
	
	
	
	
	}

void OnTriggerStay(Collider other)
{
	
if(Input.GetKeyDown("e"))
	{
		player.parent = observer;
		//HingeJoint.connectedBody = observer;
		
	}
	
	
}

as you can see, I am using C Sharp

Can’t see what the problem your having is?

try using a boolean?

var nextToCar : boolean;

function Update(){
     if(Input.GetKeyDown("space")){
           if(nextToCar){
                 player.transform.parent = car.transform;
           } else {
                 print("not next to car");
           }
     }
}

function OnTriggerStay(other : Collider){
        if(other.collider.gameObject.CompareTag("Car")
              nextToCar = true;
}