Duolingo and several translation engines stipulate 'habitant': 'résident' is refused...The particular context is '...all the residents of the Earth' for which they require 'tous les habitants de la Terre'.
Ugh, don't get me started on DuoLingo
I can only confirm that 'résident' is a valid word in French and will work as a translation of the English 'resident'... except maybe for 'residents of the Earth' (no idea whether it sounds idiomatic in English).
So I'm not going to change this translation.