You should use ViewPortLeft/Right/Bottom/Top and specify for which layer you want the coordinates. ViewPortRight(0) gives you the y coordinates of the visible right edge of layer 0. If layer 0 is not your UI layer, it will not work correctly. Also, since you are using a System Condition and not actual "Frames" conditions, I recommend you add "For each Frames" and put all 4 events under it, otherwise, unwanted behavior will most likely occur.