Star Trek is just to get an image in your head. Motivation is similar for other modes of production, labor for goods and services. At a lower stage, Communism would likely have systems like labor vouchers to credit an hour of labor, with more for more intense or skilled labor. At a higher phase with sufficient automation, this becomes less necessary to keep production going.
No problem! If you want to look more into the results of planned economies, Blackshirts and Reds is an excellent and snappy read.