Self confidence is a thing that comes with time and experience.
I was on my mid 20's before I started to feel confident about myself and well into my 30's before I stopped caring about what other people thought and was happy to just do my own thing regardless.
It's actually the independence that comes from confidence that attracts other people of quality to you in life.
So don't worry too much about it for now, just keep getting on with life 1 step at a time :)
They clearly don't deserve you then. You will get through this. You don't lose people, people lose you. I hope you are doing well and hope you are doing better in the future