Backup instruments don't need to follow the main melody but it can sound good if you can create a harmony using chord inversions so that the top note of the chord (or bottom) stays in harmony with the main melody. A basic knowledge of music theory helps here, of course.