The easiest way is if you record it using your computer microphone. To get a more professional sound, use an external USB microphone, or connect an external microphone via an audio input device (audio interface). Remember to use headphones in order to avoid feedback noise, and try to find a nice and quiet room to record in :)
(For information on how to record an electric guitar, click here.)
Let's take an example where you're recording an acoustic guitar with an external mic (connected to your computer via an audio interface or USB, it makes no difference here.) You have found yourself a nice and quiet spot to record your guitar in, you've got your mic up and your headphones on. You're hopefully sitting on a not-too-squeaky chair. (If you're playing some quiet fingerpicking for instance, it's important to keep noise to a minimum.)
A good starting point when positioning your mic is around 20 cm (8 inches) from the point were the neck of your guitar meets the body, aimed directly at the strings (1). This should give you a nice balance between the sound coming from the body of the guitar and the strings, but feel free to experiment by moving the mic around and angling it differently.
If your audio interface or USB mic has a gain control, turn it up a little until you get a signal from your mic. Please refer the to manual of your interface or USB mic for instructions on how to operate it. Next, add a new Voice & microphones track to your Soundtrap project (2). In the instrument view, select your input device and start recording!
(1) A good starting point when positioning your mic!
(2) Add new track - Voice & microphones