My "If" statement won't activate

I can’t get this “if” statement to work when I click either Afslut1 or Afslut2.
When i put the “if” statement inside a “when” statement it works fine.
But I just want it to trigger passively without the “when” statement.
What have i done wrong?

If you are trying to activate the ‘if’ statement without activating anything else, then use a ‘Run parallel’ block, and put your ‘when’ statements in the top bit and your ‘if’ statement in the lower part.

Hope that helps!!


Hi @Fisher24,

Your IF statement does activate, but only once, when the CoBlocks compiler first runs it. In order for it to run outside of the when events, you have to constantly run the IF statement using a forever loop.

There is a better way to reduce duplication (and consume less memory) though - put your IF statement into a Function, then call your function inside your event blocks.

Hope that helps - if so, please mark this as resolved.

Geoff @ TechLeap