Move Slider-value to middle value when released

Hello,

I am trying to move my player with a slider on its x-axis.

The player-movement speed is determined how far the value is away from 0, the middle value.

However, when the Handle-slider is released, it should turn back to 0, else it will keep adding x-movement to the player.

It can be compared to “Input.GetAxis(“Horizontal”)” as it has the range from -1 to 1 and goes back to 0 if nothing is pressed.

Thanks in advance.

Does the player move the slider using a mouse or touch?
Assuming you don’t want anything too fancy (just something that works), you could simply use input.getmousebuttonup(0) inside of update, and then set the slider to the middle whenever that happens :slight_smile: