Do not use TAB in the script editor. Remove every single TAB and it will work fine. To indent, only use spaces.