Apply gravity to parents

Hello, in the platform game I’m making I want to apply gravity to the platform if the player stands on it. At this moment I have 2 gameobjects. A and B.
A is the visible platform and B is an invible trigger to check if the player hits the platform. B is also parent of A. I also added a rigidbody to object A and B and unchecked use gravity.

But when the player now hits the platform gameObject B falls down. This makes sence because the code is attached to B. I’d like to know how I can apply gravity to A wich is a child of B.

This is the code I attached to gameObject B
:

function OnTriggerEnter (hit : Collider) 

{

if(hit.gameObject.tag == "Player")
{

var MyObject = gameObject.GetComponent(Rigidbody);

MyObject.rigidbody.useGravity = true;

}
}

var platformA:Transform;

function OnTriggerEnter (hit : Collider){
if(hit.gameObject.tag == "Player"){
var MyObject = gameObject.GetComponent(Rigidbody);
platformA.MyObject.rigidbody.usGravity = true;
}
}

It’s untested. But I think it will work. Just drag the platform A object into the transform variable.