The court will consider a number of factors in determining what is in the best interest of the child. That standard - the best interest of the child - will guide many of the decisions the judge will make. If you can put yourself in a position to better assist them, such as earn a paycheck, have a safe place for the kids to be etc, you are putting yourself in a better position for custody. If you cannot afford an attorney you might look into divorce clinics put on by the local bar as well as organizations like Legal Aid.
Links:
Divorce advice
Legal Aid
Consumers can use this platform to pose legal questions to real lawyers and receive free insights.
Participating legal professionals get the opportunity to speak directly with people who may need their services, as well as enhance their standing in the Lawyers.com community.