What exactly are you buying? Are you buying a half interest in a 4-plex for $340,000? Or does the 4-plex cost $340,000 and you are buying half? Without knowing anything about the property and the income and expense, no evaluation can be made of the investment. You also don't state the rates and terms of the student loans.
The fact you have not posted any of the property details indicates to me you do not know much about the property or about real estate investing and you are relying on your friend. In your shoes, I would want to know a lot more about the specific property and about real estate investing before I wrote any checks.
You have a large student loan balance. Even with the good income, it may make more sense to get rid of those and study real estate investing in the meantime.