Behavior Tree switches rapidly between two nodes even though conditions are properly set

I’m experimenting with using the AIPerception component for perceiving actors with sight, and I’m trying to develop a basic “follow the player” AI. The AI Controller is used to detect the player character and sets the values on the blackboard accordingly:

Similar to the [BehaviorTrees example here][4], I want the AI to stop following the player once they’ve hidden behind an object. The Behavior Tree below is the one I’m currently using; the selector node underneath the ROOT doesn’t have a service like the BehaviorTrees example because all the values are being set from the AI Controller as shown above.

Right now, I’m having this strange issue where the behavior tree seems to be switching between my “TargetIsSet” selector and “TargetIsNotSet” service nodes once the player hides behind an object or otherwise leaves the AI’s detection range. The in-game result is that the AI just keeps following the player until they come back into range, at which point the “TargetIsSet” selector behaves as normal. This happened even when I set up my blackboard and behavior tree exactly like the one in the example (not using the AI Perception component, but straight Line Traces and the like).

The issue is especially strange because all of the debug information is showing that the Blackboard for the BehaviorTree is being properly updated by the AI Controller; when the player steps out of the range, the Target value on the blackboard is cleared out, and the following behavior works fine when the player is in the AI’s visual range.

I’m completely stumped as to why this is going on. Any help would be appreciated.