The loop should execute whenever the value is more than .5 and break if it is under .5. Connecting this to a switch, the loop does not break when the value’s changed under the requirement and instead overlays on itself when the value meets the requirement again.
If you want to you can just submit a working version of this as I’ve spent three days attempting to fix this code.