Let’s start by setting up a trigger script with all the variables and objects we need to store the internal state:

We now have a configurable trigger that exposes the following functionality and options! Yay!

The magic here is the On Trigger Activate and On Trigger Deactivate parts of the script. This allows us to bind as many actions as we like to a trigger! COOOL.

Let’s get onto the meat of the code, the logic: