Clickable object within radius

I am making a puzzle game and in the end of each level there should be a Cube to click on and it will transport you to another level. But the thing is that with the script that I am using right now makes the Cube clickable from whatever range. I want it to only be clickable within a specific range. How do I do that?
This is the script I am using right now:

#pragma strict

var Sound : AudioClip;
var coll: Collider;

function Start() {
	coll = GetComponent.<Collider>();

function Update(){
	// Move this object to the position clicked by the mouse.
	if (Input.GetMouseButtonDown(0)) {
	    var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
	    var hit : RaycastHit;
	    if (coll.Raycast(ray, hit, 100.0)) {
			transform.position = ray.GetPoint(100.0);

I would rather not make a whole new script, I would rather just change some things inside the script I am using right now. Please answer detailed so I can understand. c:


To deal with effective range, I usually create a trigger collider around the gameObject that needs the effective range.

In your case, you can place a trigger collider around the cube, and when the player or whatever touches the trigger collider, then the cube is clickable.


 function OnTriggerStay(other : Collider){
    if(other.tag == "player"){
    clickable = true;

function OnMouseDown(){
//play sound, teleport player