Under barter, economic actions are linked, production with consumption, savings with investment, wages with prices. One can trade for mutual benefit or accumulate assets and inventories but that is the only way to separate these functions, speculate, or store wealth. There may be excess or shortages of specific goods but never all goods at the same time. The hazards are vicissitudes of life, nature, and the market.
With money all these actions may be separated and wealth accumulated more conveniently. For these benefits, there is a price to be paid, and that is an shortage or excess of money. A shortage results in deflation while an excess in inflation. Both impair the function of money as a medium of exchange, deflation by elevating its function as a medium of storage at the expense of trade and the economy, inflation by lowering its function as medium of storage diverting it into assets and inventory. Money largely works through interest rates and credit, making investment more or less risky. This has real effects when investments fail or succeed, though they may fail due to the underestimation of risk as well as its increase and succeed due to the overestimation of risk as well as its decrease. Deflation can destroy money by credit contraction, bankruptcy, and making otherwise profitable investments unprofitable. Inflation can create money by credit expansion and making otherwise unprofitable investments profitable, some of which may only be profitable with inflation though these will be realized over time. These can amplify themeselves over time, but if not allowed to do so, economies can adjust and neutralize them over time. Otherwise it can lead to a return to subsistence and barter.