Hi There,
I think you might want to move your current code snippet into the “End Routine” tab. Because you won’t know which key was pressed until the end of the routine. Then add a seperate “feedback” routine within your “animals_01” loop but following your “trial” routine, add a text component in the feedback routine and set the text parameter in that component as $response.
Good luck!
Becca
PS. I think similar but slightly different issue here Printing a counter as participant feedback in next routine