Parenting On Trigger not Working?

Hey Everybody! So I have a Ship that has a Box Collider inside it. When My player collides with the Collider, it activates an AI Script. What I was trying to do was that at the same time, have the Player Made a Child of the Ship So that it goes wherever the AI goes, until nessecary. So therefore the Player needs to be Inactive for a variable amount of time. I was using this script but instead of getting parented, the player just goes flying off the edge! Is there a different script that I should use?

UPDATE! I FINALLY FIGURED IT OUT:

var scriptname1 : GameObject;

function OnTriggerEnter(other: Collider)

{

if(other.tag == "Player")

{

scriptname1.active = false;

   other.transform.parent = transform.parent; 

}

}

function Update () {

if (Input.GetKeyDown (“e”)){

Destroy(gameObject);

scriptname1.active = true;

}

}

Thanks for all your help!

Here is the mostly Correct Script, the one thing I cannot figure out is getting out of the ship.

var scriptname1 : GameObject;

function OnTriggerEnter(other: Collider)

{

if(other.tag == "Player")

{

scriptname1.active = false;

   other.transform.parent = transform.parent; 

}

}

function Update () {

if (Input.GetKeyDown (“e”)){

Destroy(gameObject);

scriptname1.active = true;

}

}

Not sure but wouldn’t “col.transform.parent = transform.parent;” just be “col.transform.parent = transform;”?

hallo, I use this, found somewhere here, on a trigger inside the lift

var platform : Transform;
var player : Transform;

function OnTriggerEnter () {
   player.parent = platform;
}

and this on a trigger just when exit the lift

var platform : Transform;
var player : Transform;


function OnTriggerEnter () {
  player.transform.parent = null;

}

using OnTrigerExit on the trigger is in the lift don’t know why, but don’t work