Slider Script Crashes Unity

Hi, I am creating a slider that starts in the middle and moves back to the middle over time when moved. For some reason my script crashes unity when I try to move the slider to the right, but works exactly how it should when I move the slider to the left. Any idea why this is happening?

var cameraSliderValue : int = 5;
var movingCamera = false;

function MovedSlider(){

movingCamera = true;
while (cameraSliderValue != 5)
{
    if (cameraSliderValue > 5)
    {
        cameraSliderValue += -1;
        yield WaitForSeconds (2);
    }
    if (cameraSliderValue < 5)
    {
        cameraSliderValue += 1;
        yield WaitForSeconds (2);
    }
}
movingCamera = false;
}

function OnGUI () {

cameraSliderValue = GUI.HorizontalSlider (Rect (470, 830, 300, 25), cameraSliderValue, 0, 10);
if (GUI.changed == true){
    while(movingCamera == false){
        MovedSlider();
    }
}
}

function OnGUI () {

cameraSliderValue = GUI.HorizontalSlider (Rect (470, 830, 300, 25), cameraSliderValue, 0, 10);
if (GUI.changed == true){
    if(movingCamera == false){
        MovedSlider();
    }
}
}