When people ask tips on how to write good riffs, most people will say to learn scales. Forgive the slightly noobish question but how can you then transpose the learnt scale to help writing a riff?
A scale gives you a set of sounds that work together in a certain way - like a pallete of colours. If you want to make use of the particular sounds contained within a certan scale then you'd use that scale.
Plus its easier to know what key you are in.
Don't just learn the scale. Learn the notes on the fretboard. Learn the scale pattern. Learn the intervals, and find out what all sounds you can make. Theory is a great thing, and will boost your riff building tons.