Target.position Not working?? Thanks!!

Hello!! I'm having trouble getting this script to work :P Basically I'm using Royce Kimmon's dialogue engine/generator, and I'm trying to make a trigger for it. Basically i wanna be able to click on the object thats going to be talking, but i wanna make it so they have to be within a certain distance of the object to be able to talk to it.

Here is what i got so far (if you have any tips, please say xD I just started programming yesterday):

var talkmessage : boolean;
var target : Transform;

function Start () {
var d : DialogueInstance = gameObject.GetComponent(DialogueInstance);
if (d) d.enabled = false;
talkmessage = false;
}
function OnMouseOver () {
    var d : DialogueInstance = gameObject.GetComponent(DialogueInstance);
    if(talkmessage) {
        if(Input.GetButtonDown("Fire1")) {
            d.enabled = true;
        }
    }
}

function Update () {

if ( Vector3.Distance(target.position, transform.position ) < 25) {
talkmessage = true;
}
if ( Vector3.Distance(target.position, transform.position ) > 25) {
talkmessage = false;
}
}

And i have target.position set to my player. This script is being applied on my object.

Thanks guys!!! Hoping I'll be able to help noobs like me eventually!

i would use a sphere collider as a trigger (http://unity3d.com/support/documentation/ScriptReference/Collider.html) and when the trigger is activated change your talkmessage to true. I would then create add a new script to the collider object with the following: `

OnTriggerEnter(collider : Collider)

{

if (collider.GetComponent(the_name_of_your_script))

collider.GetComponent(the_name_of_your_script).talkmessage = true

}

OnTriggerExit(collider : Collider)

{

if (collider.GetComponent(the_name_of_your_script))

collider.GetComponent(the_name_of_your_script).talkmessage = false

}

`