how to limit distance?! about Dragridgitbody

Hello! I need your help I have Dragrigidbody shadow.js

I would like to know to make it so that you can drag it from only a close range about 2.5 meters

script is


var spring = 50.0;
var damper = 5.0;
var drag = 10.0;
var angularDrag = 5.0;
var distance = 0.2;
var pushForce = 0.2;
var attachToCenterOfMass = false;
var maxRange = 2.5;

var highlightMaterial : Material;
private var highlightObject : GameObject;

private var springJoint : SpringJoint;

function Update()

var currentRange : Transform;

	var dist = Vector3.Distance(currentRange.position, transform.position); 

	if (!Input.GetMouseButtonDown (0) || currentRange > maxRange)


however, I have error Operator ‘>’ cannot be used with a left hand side of type ‘UnityEngine.Transform’ and a right hand side of type ‘int’.(BCE0051)

How can I fix it?! I mean how to limit distance?!

I need your mercy help me plzzzzzzzz

P.S Sorry my terrible english skills because Im south Korean XD

Thank you !

Well, i am assuming you should be doing this:

 if (!Input.GetMouseButtonDown (0) || dist > maxRange)

You can’t compare a vector3 to a int.