How to loop component begin overlap blueprint

So what im trying to do is make an AI spawner, that has a set range, and when a player enters the range it spawns AI/mobs until the player leaves the range or kill the spawner.

Im pretty sure I have it setup correctly, but ever time I try a whileloop, I get a infinite error. I also tried with a gate, but my lack of UE knowledge is preventing me from using it correctly.

Here is the code im using.

For example

One simpler way is to use a Timer node: https://docs.unrealengine.com/en-us/Gameplay/HowTo/UseTimers/Blueprints

I read else where that aswell, but im a little lost on which type of timer function to use, ive read that link you posted and I was a little confused on how to implement it into what im trying to do.

Another way to do it (besides the one @Chyros mentioned) is to set a boolean in begin and end overlap for example named “isOverlapping”. then use it in the tick function.

here is a good link : Is there a "Is Overlapping" in Unreal - Programming & Scripting - Unreal Engine Forums

Just set it up like this and it will work how you want.

Spawn Time is a custom variable you create and set to how frequent you want an enemy to spawn.
Spawner Handle is a custom variable that allows you to control the timer, being able to turn it off when the player exits the target area
Spawn Enemies is a custom event you create that the timer drives based on the “spawn time” you set