Thanks x2. I [probably] fixed the number formatting, and that error message is super useful. It even gave me the line that caused the error!! I made some changes, and I might have fixed it.
I think it's due to the numbers that pop up when you buy an upgrade. If a function crashes, it ends the function right there so the whole game doesn't crash, meaning the upgrades would not go away, but everything else that already went through would stay changed.