| Reference | Downloads | Github

Ratings on slider and clicking on a box to continue

URL of experiment:


My experiment presents some statement and after 5 seconds in each trial, a slider, a mouse and a box appear. I want to make sure that participants rate their response on the slider and then click on the box to continue to the next trial. So, I used this code in the each frame tab and it worked fine:

// continue if both slider and mouse is clicked

if (mouse_save_prac.getPressed()[0] === 1) { 
  clickable = [save_box_prac];
  for (const obj of clickable) { 
    if (obj.contains(mouse_save_prac)) {
      if (obj === save_box_prac && practice_bright_slider.getRating()) {
         continueRoutine = false;
      } else {
        continueRoutine = true;

However, the problem is that if participants click on the screen before the mouse onset, they will got this error: TypeError: Cannot read property ‘map’ of undefined.

Are there any ways to solve this problem?