Yes. In the piano-roll for an instrument track, there are a few buttons besides the play button. So, the "Play" button is the first button. The second button is a hollow circle, and it lets you record while playing the contents of only the piano roll. The third button is a circle with a triangle inside, and it lets you record WHILE playing the entire melody.
Look at this link in the LMMS documentation: https://docs.lmms.io/user-manual/3-navi ... and-record
It should help you.
All the best with LMMS!