"What happens if a MP leaves parliament, so does he/she get replaced?"

Yes, you’re right! If a member of the House of Representatives dies or resigns between federal elections, they will be replaced in a by-election. A by-election is a mini-election for one or more seats in the House of Representatives.

diagram to help explain What happens if a MP leaves parliament, so does he/she get replaced?