Skipping 2 routines based on condition

Hi all!!

I have a routine that has a practice trial and test trial. In the practice trial there are 24 trials split into 2 x 12 trials.

If the participant scores at lest 8 in the first 12 trials, it moves onto the test routine, else, the participant proceeds onto the 2nd 12 trials. If the participant does not score at least 8 in the 2nd 12 trials, it will skip the test routine. I have included the code as such in the Begin Routine tab of my test trial:(both the instruction and trial routine (i.e., “startGame” and 'trial2 (testLoop)" respectively)

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

However, this logic does not work and the participant still moves onto the test round instead of proceeding onto the next routine if they fail the 2nd 12 trials.

I have included the flow of my experiment here for better understanding.