Thanks! Unfortunately, I'm still having the same issue with the level repeating, only now I'm getting a different error:
Error executing function 'onOverlayUpdate': Cliff2/Script/main.singe:23: attempt to perform arithmetic on a nil value (local 'thisMuch')
EDIT: I just tested it again, and the bug only occurs if I play through the level perfectly. I'm pretty sure at this point that the bug has something to do with the end-of-level point bonus and the penalty applied for dying.