Don't lock yourself into thinking that the scale or pattern has to start or end on the octave or root, has to be ascending or descending. That's a great way to learn the notes but leaves you with a sterile sounding riff. Bop around some. Throw some random triplets in there as well.
It's worth mentioning that starting a scale on a note other than the root is a mode.
For example, Dorian mode starts on the 2nd, but uses the same notes as the scale it's named from.
C Major = C-D-E-F-G-A-B - Intervals = W-W-H-W-W-W-H
C Dorian = D-E-F-G-A-B-C - Intervals = W-H-W-W-W-H-W
Another:
D Major = D-E-F#-G-A-B-C#
D Dorian = E=F#-G-A-B-C#-D
Notice the notes and intervals don't change, the pattern of them simply rotates. All scales and modes continue up AND down, as long as the notes exist on your instrument.
It's a similar idea to relative minors. A minor is relative to C, so A minor = A-B-C-D-E-F-G. Notice it's the same notes and intervals as C Major, starting on A. The relative minor happens to be Aeolian mode.
Music theory is a study in itself, applicable to all tonal instruments, and well worth classroom time and tuition if you can find a local college or music school that offers it to part time students. If you're in High School, some schools offer it as an elective. It's usually taught around a keyboard for better visualization.
I'm far from a theory expert, it's a rabbit hole that can engulf you, excite you, and sometimes bore you to sleep. However, the basics of scale and chord construction, modes, the Circle of Fifths, rhythmic concepts, etc... Can help you improvise and create better, and you'll learn to hear and recognize intervals and patterns enabling you to pick up songs far faster.
And then... you'll learn all rules are made to be broken for the sake of art.
