Routine does not continue

I have a current routine set up where in a routine there are 24 trials separated into 2 x 12trials. If the participant do not score at least 8 in the first 12 trials, an image is presented to inform that they will be going for the 2nd round of 12 trials. The current flow is set up like this:

In instr2, i have set up a code in the Each Frame tab and set continueRoutine = False, and only show when participants do not score at least 8 in the first 12 trials. The image shows, however it just freezes and does not proceed after to show the 2nd round of 12 trials. Here is my code.

continueRoutine = False

if practiceLoop.thisTrialN == 11 and score <= 5:
continueRoutine = True

Am i missing something out and that’s why it is not able to continue running?

How about the following in Begin Routine

if practiceLoop.thisTrialN == 11:
     if score > 5:
          practiceLoop.finished=True 
          continueRoutine = False 
else:
     continueRoutine=False 
     

Hi! Thanks for your help. I shifted my logic to the Begin Routine tab and it works now!

Hi! Thanks, that made it much better. I realised it should be in the Begin Routine instead of Each Frame which I previously did

Hi sorry! I realised that even though I got 8 correct on the 12th trial, that routine continues when it is not supposed to. Did i miss something out?

Why do you have 5 in the code?

I only want the Instr2 to begin if participants do not score at least 8 on their 12th trial. So I

These two statements are contradictory. Change the 5 in my code (which I copied from your code) to the largest failing score.