Student loans that are unpaid will stay on your credit report for a period of 7 years.
After 7 years the unpaid student loan should not hurt your credit rating anymore or have less affect on the credit score.
If you're paying on student loans and still have unpaid student loans after 25 years then the student loans are forgiven after a period of 25 years.