Is the goal with this code a subgoal of one that only activates once your level loads? If this is in a top level goal, then you will try to register the triggers for the players before your level gets loaded. If they are local triggers, they won't even exist yet. If they are global triggers, it might work, but I'm not sure (because this will still be called before the game has fully initialised).

Have a look at https://docs.larian.game/Osiris_Design_Patterns#Program_Initialisation for how to ensure that your goal only initialises once your level has loaded.