Horizontal Slider Won't Move

I’ve looked this up and I don’t know what my problem is, I’m not getting any errors, but when I try to drag the slider back and forth it won’t budge

var hSliderValue: int = 0;
var slider =  Rect(200, 150, 150, 50);
function OnGUI(){
if(isLeveled){
		GUI.Box(Rect(50, 50, Screen.width -100, Screen.height - 100), "Congratulations! You've leveled up!");
		GUI.HorizontalSlider(slider,hSliderValue,0.0, levelPoints);
		GUI.Label(Rect(200, 75, 200, 25), "You have: " + levelPoints + " points to spend");
    }

There’s more code to this but I don’t see why anything else would be effecting the slider, can anyone think of why it’s not working?

You need to get the new value from the slider each frame like this:

sliderVal = GUI.HorizontalSlider(slider, sliderVal, 0.0, levelPoints);

It works like this:

The slider gets drawn every frame.

The value at the beginning of the frame is determined by the 2nd parameter passed to GUI.HorizontalSlider.

This function then returns the new value of the slider, so you need to capture it somewhere and feed it back to GUI.HorizontalSlider in the next frame.