you need to store the variable in some class, you can store it in the player character and set it to public, you can easilly edit variables from multiple sources, the hard thing about usually is getting the reference to where the variable is, but you can easily use “get player character”, cast to your character and get/set the variable, you would just need to set it to true when the player goes in the light and set to false when it goes out of the light, probably there would be a problem if you put 2 lights in the same place, otherwiser it should work.
changing a character’s variable from another class:
PS.: remember that the variable needs to be public, to set them to public go to your player BP and click in the “eye” icon in the left side of the variable in the “variables” panel, closed eye means private, open eye means public.