Don’t deserve happiness

Sometimes I just randomly feel like I don’t deserve to be happy. Like I don’t deserve good things, don’t deserve love and don’t deserve to have a family/kids someday. I feel like I’ll be bad at everything I do in life. I’m not sure why I randomly will feel like this. Just wondering how to make it stop.