Script Debugger 5.0.12 can't save the script as compiled script

The script in question is

set NumbersList to {5, 10, 15, 30, 5, 10, 35, 40, 50, 5}

set SecondaryTrails to {}

repeat (count NumbersList) - 1 times
	repeat with i from 1 to the number of items in NumbersList
		set ObjCompared to NumbersList's item 1
		set SecondList to the rest of NumbersList
		repeat with i from 1 to the number of items in SecondList
			set theObj to SecondList's item i
			if theObj = ObjCompared then
				if ObjCompared is not in SecondaryTrails then set beginning of SecondaryTrails to ObjCompared
				set SecondaryTrails to SecondaryTrails & theObj
				set {theObj, ObjCompared} to {missing value, missing value}
			end if
		end repeat
	end repeat
set NumbersList to the rest of NumbersList
end repeat
return SecondaryTrails

It fails to save with alert “Script Debugger can’t save the document”. I don’t understand why. macOS Lion 10.7.5. I could only save it as text.

Works for me, but then I’m on a modern OS, 11.x. You tried pasting it into a new document? You tried saving to a different location? You tried commenting it out hunk by hunk to see if some line is causing a problem?