How to trigger something after enemy dies?

You will need an List for this.
Lists are like arrays, but are mutable, meaning you can add and subtract from them running runtime.

  • The List should be on an object that’s in the game all the time, either an actor or game mode.

  • Once the player activates a trigger,

  • it activates the barrier

  • spawn the AI, with a BeginPlay that adds itself to the List by calling the List’s Custom Event

  • Once the AI dies, it calls a different Custom Event on the List. That Event should evaluate every time it’s called if the List size is <= 0. If so, then deactivate the barrier.

Simple really.