I have a room in my game where the player can be safe from the enemies if inside the room. Basically a script or something that makes it so then player can walk into a room but the enemies are not able to go inside, making the player safe at that time.
I suppose you have an function that makes the enemies follows you right?
Try making an “Idle” function or what so ever and cover your safezone area with an trigger box.
Use a basic script to make it so if the enemy triggers this safezone triggerbox, activate the “idle” function in the enemy and stop the “Follow” function.
Im not an proffesional but i suppose it would work.