Having a Student loan won't prevent you from getting a mortgage. That is unless you've been missing payments on the student loan. Then it would lower your credit score which would affect you getting your mortgage loan.
Having a student loan and making on time payments could actually help you get your mortgage in the future when you're ready.
A good credit score is vital to getting loans and mortgages. Always make sure you keep your credit score in a good range above 620. The higher the credit score the better.
Having a higher credit score can also mean lower interest rates on your mortgage and other loans.
And also having a high credit score could help you land a job too. Some employers look at peoples credit score when deciding to hire someone.