You, as a human being, have a limited ability to resist temptation.
Anything within your means that you want badly enough you’ll eventually have. The only way around it is to want something else, mutually exclusive to the first temptation, more.
And when it comes to weight loss, even if you’re in the 5% of attempts that are successful, most people will still gain weight back because once the motivation of setting numbers go down fades, old habits are always just as easy to fall back on as all the new ones are.