Saying what you come up with sounds "really bad" is insufficiently specific for me to really diagnose what your problem is, or even really grasp how sophisticated your attempts are. So in absence of other information, I'm going to proceed on the assumption that you are a total beginner who cannot yet generate even the most basic musical phrase.
Knowing your chords and scales is helpful, but won't cut it. To improvise you need to know more theory of how music functions to come up with something that works.
There are sort of two dimensions of learning to improvise. One of them is conformance to style. For instance, if you want to be able to improvise jazz, you need to be deeply familiar with what jazz sounds like, what it feels like in your hands to play, and what its musical idioms are; you would be well advised to learn the theory specific to jazz.
The other dimension is general improvisatory skills: how to pick some musical concepts and work with them; how to remember what you just played so you can play it again; how to think quick enough to improv in real time without panicking and flailing at your instrument, etc.
A non-obvious thing about improv is that it can't really be learned in the general in the absence of a specific style.
If you don't have a specific style you're trying to learn to improv in, then it makes sense to pick one that's super easy to start with, to start building those general skills. Also, if the genre of music you want to improv in is particularly complex – you want to be able to duo improv cool uptown jazz with an upright bassist – it might also make sense to pick something simpler to start, and work up to it.
Also, please be aware: you are probably not going to be able to improv in a style of music that is beyond your ability to play either by ear or from a score. That is, if you can't play it when somebody else wrote it, you probably are not magically going to develop the ability to manifest it out of your imagination. For one thing, most musical styles have some technical demands. If you haven't met them sufficiently to play the composed stuff, that same limitation means you won't be able to play those figures in improv.
If you're looking for a super-super-simple style for the piano – and here I'm using "style" extremely loosely – try black keys only. Playing the black keys only gets you into the pentatonic scales, in which all notes are universally harmonious. There are literally "no wrong notes" to play together.
I do an exercise teaching expressive improv to non-musicians, including children, at the piano this way. I start with the following framework of rules: One hand only. One note per beat, seven quarter notes followed by a quarter rest (i.e. 4/4 time), indefinitely repeated. Set a timer: three minutes.
Once the student can manage that, I add the "rule" that the seventh note in each seven note series must be a ___ (any one note), but in any octave. Do the exercise with each of the different five terminal notes.
Next complication: two hands. Both hands need to conclude each phrase on the right terminal note, in different octaves.
Next complication: same exercise, but instead of one terminal note, alternate between ending on a ____ (pitch of your choice) and a ___ (different pitch of your choice), any octaves.
Next complication: sub-divide occasional quarters (not terminal ones) into paired eighths. At first, it will help to designate in advance which quarters will be subdivided. For people who don't have a lot of hand separation, this exercise can require a return to one-handed attempts at first.
Usually somewhere around here people start getting quite melodic.
Next complication: A different time signature, such as 9 eighths, a quarter, and an eighth rest (6/8). Start constructing exercises on all the other time signatures you want. Emphasis can be used to represent compound signatures.
If you're at this level of total beginnerhood, try this series of exercises and see if they help. It should become obvious as you do them how you can keep complexifying them to bring more and more of what you like, musically, into them.