# Question about Unit 6 Lesson 6

**URL:** <https://forum.code.org/t/question-about-unit-6-lesson-6/24404>\
**Category:** Unit and Lesson Discussion\
**Tags:** csd-unit-6-lesson-6\
**Created:** [December 28, 2017, 12:57pm UTC](https://forum.code.org/t/question-about-unit-6-lesson-6/24404 "2017-12-28T12:57:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lluchsinger](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@lluchsinger](https://forum.code.org/u/lluchsinger)\
**Post date:** [December 28, 2017, 12:57pm UTC](https://forum.code.org/t/question-about-unit-6-lesson-6/24404/1 "2017-12-28T12:57:24Z")

</div>

in lesson 6 puzzle 15 I have to admit that I am stumped. I have tried multiple methods but keep getting stuck trying to enter a variable in as an id. What solutions have others come up with. Could we get some hints for this puzzle going forward?

---

<div class="post-metadata">

**Author:** ![josh](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/josh/32/868_2.png) [@josh](https://forum.code.org/u/josh)\
**Post date:** [January 2, 2018, 4:58pm UTC](https://forum.code.org/t/question-about-unit-6-lesson-6/24404/2 "2018-01-02T16:58:56Z")

</div>

I’m not sure I understand the question - when you say “enter a variable in as an id” do you mean using a variable in place of an element ID in a block like `setText`? If so, what kind of behavior are you seeing when you try to do it? FWIW, this puzzle has been removed from the next version of the Unit 6, expected to be released by the end of the month.

---

<div class="post-metadata">

**Author:** ![cmelendez](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@cmelendez](https://forum.code.org/u/cmelendez)\
**Post date:** [May 22, 2018, 3:23pm UTC](https://forum.code.org/t/question-about-unit-6-lesson-6/24404/3 "2018-05-22T15:23:10Z")

</div>

Does anybody have any sample solutions to the final motorcycle puzzle? I am a see when it comes to CS and I am piloting this for my school. We(Students and myself) are stumped on this one.

---

<div class="post-metadata">

**Author:** ![jreuther](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jreuther/32/4329_2.png) [@jreuther](https://forum.code.org/u/jreuther)\
**Post date:** [December 11, 2018, 8:11pm UTC](https://forum.code.org/t/question-about-unit-6-lesson-6/24404/4 "2018-12-11T20:11:07Z")

</div>

Is this the correct code for Lesson 6 Puzzle 16 (motorcycle with slider):

// Set the speed of the motorcycle  
var speed = 10;

// Move the motorcycle up when the left button is clicked  
onBoardEvent( buttonL, “press”, function(event) {  
var y = getProperty(“motorcycle”, “y”);  
setProperty(“motorcycle”, “y”, y - speed);  
});

// Move the motorcycle down when right button is clicked  
onBoardEvent( buttonR, “press”, function(event) {  
var y = getProperty(“motorcycle”, “y”);  
setProperty(“motorcycle”, “y”, y + speed);  
});  
onEvent(“slider”, “change”, function(event) {  
speed = getProperty(“slider”, “value”);  
});

---

<div class="post-metadata">

**Author:** ![jwofsey](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jwofsey](https://forum.code.org/u/jwofsey)\
**Post date:** [February 15, 2019, 2:07pm UTC](https://forum.code.org/t/question-about-unit-6-lesson-6/24404/5 "2019-02-15T14:07:00Z")

</div>

You need to create an event that sets the speed variable to the slider value when the slider is changed. See below:

// Set the speed of the motorcycle  
onEvent(“setSpeed”, “change”, function(event) {  
var speed = getProperty(“setSpeed”, “value”);

// Move the motorcycle up when the left button is clicked  
onBoardEvent( buttonL, “press”, function(event) {  
var y = getProperty(“motorcycle”, “y”);  
setProperty(“motorcycle”, “y”, y - speed);  
});

// Move the motorcycle down when right button is clicked  
onBoardEvent(buttonR, “press”, function(event) {  
var y = getProperty(“motorcycle”, “y”);  
setProperty(“motorcycle”, “y”, y + speed);  
});  
});
