I have two theories as to what's going on here---1) You have poor self-esteem or 2) You haven't yet met the right nice guy. If it is a self-esteem issue, it's something you need to work on--and I don't say this lightly--it takes a good deal of work and time. If it's a matter of not having met the right nice guy--then, patience. In the meantime, avoid getting involved with the wrong ones. Before I met my husband, I, too, was attracted to some guys who weren't nice. Looking back, a lot of it had to do with how my family life was. I grew up with an abusive, narcissistic mother and a passive father. One thing about the guys who aren't nice--they make you miserable. And seriously, is that what you want? When I met my husband, I was bowled over at how nicely he treated me on our first date. It was then that I realized that I didn't want to ever get involved with someone who didn't treat me well. Before I met him, I would meet some nice guys from time to time. The problem was I felt no attraction to them. Sometimes, I would even ask myself what was wrong with me. However, I realized it took more than just being nice, there had to be some physical attraction as well as shared interests and values.
So--if you really want to change things, first resolve to not get into a bad relationship. If you find yourself in one, then break it off. One thing I've learned as I've gotten older--it's better to be alone than in a bad relationship. Second, work on your issues. If you find that you can't do it alone, seek out some counseling.