Stopping (pausing) the script when cursor reaches the end of the screen

then, if this is in a PlayerController blueprint, you can get screen resolution from HUD, you can use getMousePosition to get where your cursor is.