dragging object horizontally only

hi. I'm looking for a script that would allow for horizontal drag (works just as a slider, only it is not GUI, but attached to game object). so you basically could click on an object, then drag it horizontally from min to max position..

here, in the example, we'd be able to drag the "playbutton" horizontally. but I think I messed the thing up.

 var TimeLine_PLAYBUTTON:Transform;

function Update(){
    Select_and_drag();
}

var focus:Transform;
function selectingFocus(){
    var hit:RaycastHit;
    var ray:Ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    var tempFocus = focus; //last frame focus

    if(Physics.Raycast(ray, hit)){
        focus = hit.transform;
    }
    else
    {
        focus= null;
    }

}

var dragging = false;
function Select_and_drag(){
    if(Input.GetMouseButtonDown(0)){
        //checking what did we click on
        selectingFocus();
        //checking if that thing is a PLAYBUTTON
        if(focus == TimeLine_PLAYBUTTON)
            {
                //if so, we drag the play button
                Drag(TimeLine_PLAYBUTTON);
                dragging = true;
            }
    }
    //if we lift the Mousebutton - we stop dragging the playbutton
    if(Input.GetMouseButtonUp(0)){
        dragging =false;
    }
}

function Drag(trans_dragged:Transform){
     var position_dragged = Camera.main.ScreenToWorldPoint(Vector3(Input.mousePosition.x, 0.0, 0.0));
     trans_dragged.position = position_dragged;
     //checking for end...
     if(!dragging) return;
     //...or loop
     yield;
}

I'd use an OnGui method to check for a mouse drag event. You can apply Event.current.delta.x to the horizontal position of your object.