attach other rigidbody to current

hy guys,i’ve a little problem and it make me crazy.
I’m trying to attach other object(caravan) to my car,and i want it is attachable onli if the car is in correct position.
I’ve addend in car and in caravan 2 empty mesh,and that’s are setting “isTrigger”,because only when this 2 trigger have a collision i want is able to attach.
now i’ve made this script:

var currentTrigger : Transform; 
var currentTriggerName : String; 
var attaccato : boolean = false;
var atx : boolean = false;
private var other: Object;


function Update() {

		
	if (Input.GetKey(KeyCode.C)) {
	Debug.Log("attacca premuto");
	if  (atx) {
	Debug.Log("aggancio");
		transform.parent = other; 
		attaccato = true;
	}
	}
	
		
	if (Input.GetKey(KeyCode.X)) {
	Debug.Log("stacca premuto");
	if  (attaccato) {
	Debug.Log("sgancio");
		transform.parent = null; 
		attaccato = false;
	}
	}
	}
	

function OnTriggerStay(other) { 
 if (other.isTrigger == true){
 Debug.Log("yay0");
    if (other.name == currentTriggerName) { 
       	Debug.Log("yay1");
		atx = true ;
			Debug.Log("atx ready");
		}
			

	}
	}

in the log i seen the text,but caravan doesen’t attach to my car.in don’t understand where is error,because the log don’t show any error.

bump. anyone help me?

Can you show us the output?

in the log i’ve this:

yay0
UnityEngine.Debug:Log(Object)
attacco:OnTriggerStay(Object) (at Assets\script\attacco.js:34)
 
(Filename: Assets/script/attacco.js Line: 34)

yay1
UnityEngine.Debug:Log(Object)
attacco:OnTriggerStay(Object) (at Assets\script\attacco.js:36)
 
(Filename: Assets/script/attacco.js Line: 36)

atx ready
UnityEngine.Debug:Log(Object)
attacco:OnTriggerStay(Object) (at Assets\script\attacco.js:38)
 
(Filename: Assets/script/attacco.js Line: 38)