Improv has always been a topic most people ask me about, since it's the step above from playing what you learn to playing what you are. Improv is an important skill and I hope this really clears things up.
If starting to improv is hard, follow these tips to strengthen your improv range, variety, and skill.
1. Let time take its course
You can't improv on your first couple months playing guitar, obviously. Learn some songs you like, learn some difficult solos, then come back to improv. It's not something most people get right when they pick up a guitar. Improv takes fret and string knowledge, and a lot of muscle memory. If you can't play something that someone asks you to learn, then how can you expect to play something off the top of your head, right?
2. Know your theory
I'm not saying take a course on theory, but it does help. Know your scales, positions, harmonies, and definitely know what fret is what note. Tabs are easier to read, but if you don't know what notes sound good in a key (lets say, C# mixolydian), you'll play sour notes that just don't work. Know things like major scales, minor scales, blues, pentatonic, whole note, etc. Also, know what notes sound good together, like a dominant fifth sounds good, throw in a minor third every now and then, put some octaves and voila, you've got a basic minor improv.
3. Practice improv
This is pretty obvious. Improv isn't always in front of an audience, remember. You can just pick up your guitar at home and start playing notes. If they don't sound good yet, then don't fret (see what I did there?), you'll eventually get better and know what notes and what chords sound good in context. Going on stage without practicing improv is just as bad as going on stage without knowing the lyrics. Practice.
4. Know that you have room to improve
Don't shoot down critics, because most of them are probably right. If someone says you use too many chords, then try to add in licks. If someone says you hit wrong notes, try to only use the proper notes of a key. If you're hardheaded and can't accept that your improv sucks, then it'll never get better.
5. Don't be afraid to mess up
Playing twelve years of piano, the number one mistake people hear is the one that you make worse. If you stop, if you grunt, or even if you look around nervously, you're showing that you screwed up. If you just keep playing, some people may think that it was a part of the improv, and some people might not even notice it at all.
6. Learn improv
There are bunch of books that give you improv tips and tricks, and a bunch of other guitarists that can probably teach you as well. Improv can be done alone, but it helps with others around.
Now I see that these aren't amazing tips (especially for advanced guitarists), but this is how I was taught and this is how I like to teach. Between five years of guitar experience, twelve years of piano experience, and three years of drumming experience, thanks for reading, and good luck on your journey!