need help with roation

hello all iv been making a fps online game and iv made it that you can mount cars helis and tanks and i need help for when i unMount my play spawns in the right rotation cause say my car flips and i want to get out and when i get out my play will be upside down so how can i make my play spawn normal this is my script at the moment if you can help thanks alot

var PlayerPrefab : Transform;
var StandByObject : Transform;

function Update () 
{
    if(Input.GetKeyUp(KeyCode.E))
    {
        var origin = transform.rotation;
        Instantiate (PlayerPrefab, transform.position, origin + Vector3( 0, 0, 0));
        DestroyNow();
    }
}

function DestroyNow ()
{
    Instantiate(StandByObject, transform.position, transform.rotation);
}

Quick fix is to instantiate the `StandByObject` using `Quaternion.identity` instead of `transform.rotation`

like this ?

var PlayerPrefab : Transform;
var StandByObject : Transform;

function Update () 
{
    if(Input.GetKeyUp(KeyCode.E))
    {
        var origin = transform.position;
        Instantiate (PlayerPrefab, origin + Vector3( 0, 0, 0),transform.rotation);
        DestroyNow();
    }
}

function DestroyNow ()
{
    Instantiate(StandByObject, transform.position, Quaternion.identity);
}