Indeed, it would have been extremely difficult for humans to barter goods or services without using money, since such direct exchanges can only be implemented by a "double coincidence of wants."
Economics textbooks describe the three functions of money as "a measure of value," "a  1  store of value," and "a medium of exchange," and credit is the foundation of all of them. Money can perform these functions because people believe that all other people will accept money in the future.