New question about TriggerRegion.
I have a TriggerRegion that when “on”, after 3 sec it will run a function.
I’m trying to stop it from running when leaving the TriggerRegion like the .off code here
https://docs.zap.works/studio/scripting/reference/base/functions/off/
But I can’t seam to get to work.
my code:
triggerRegion0.on(“triggerenter”, (e) => {
// Get state of Block
StateOfBlockFunction();
// Wait 3 sec before changing block
Z.after(3000, function() {
ChangeTheStateofBlockFunction();
});
});
// Leave Block
triggerRegion0.on(“triggerleave”, (e) => {
HSCube0.visible(false);
triggerRegion0.off(“triggerenter”, ChangeTheStateofBlockFunction);
});
Can’t see what I’m missing.
Thanks
Steve