It looks you you are getting the value from the slider at the beginning of the program, then storing it into the speed variable. Then, you are the speed variable from then on to decide how fast the motorcycle moves. The problem with that is that it will continue to use the same value that was stored into the speed when the program was first started, rather than getting a new value from the slider every time you use speed.
There are two ways that you can fix this, but both rely on events. One thing you could do is get the value of the slider and store it into speed every time you press the button. That way it will check the slider and use the current value right before it moves the motorcycle. Another solution would be to use your "onChange" event to store the new value of the slider into your speed variable every time the slider is changed. That way the speed variable will always have the most recent value stored inside of it.