apply negative force

I am trying to make a solar system sim. This is my sun attraction script

var collidersInRange : Collider[];

function Update () {
        //find all colliders in area of influence
        collidersInRange = Physics.OverlapSphere(transform.position,transform.localScale.x);

        //attract all in range
        for(var i : int = 2;i<collidersInRange.length;i++){
*function attract(col : Collider){*
 *//takes a collider, accesses rigibdbody to find vector3 towards sun and applies inward force*
 *var trans : Transform = col.attachedRigidbody.transform;*
 *var relativePosition : Vector3 = transform.InverseTransformPoint( Vector3(* 
 *trans.position.z ) );*
*<p>right now the attract makes all the planets move away from the Sun, so the Sun is repelling them instead of attracting them. How can I apply a negative force here?</p>*

d'oh, just had to add - to relative position

Put a minus in front of the Vector 3 to reverse the vector so you're applying positive force towards the sun.

Where exactly do you have this code on. I have a sun in my plantery system and a ball that i want to be attracted by the sun.

I have tried the code on the ball with the sun as an element, then on the sun with the ball as an element and nothing worked.

Might you know where exactly to put it, and what should i change if i need to change something

use formula “Force = mass * acceleration” to find opposite vector magnitude.