Creating a visibility meter, how do you increment a variable over time while spotted?

I’m trying to implement a visibility meter for a 3rd person stealth game that increments over time while the player is visible to the AI, and once the meter is full the AI will chase the player. I’ve already implemented the AI’s behavior tree but I’m having an issue with how to increment a variable, over time, only while the AI can see the player.

The first switch statement handles the AI’s sight, and in my attempt at solving the problem I’ve run into an infinite loop. Also the second switch statement handles the AI’s hearing and won’t be needed for the visibility meter.

Found the Set Timer by Function node and managed to fix the problem myself. (ignore the Set Sight Location)