Some people can't afford homes because investors are buying them. There is zero reason to believe that prohibiting investment properties would allow everyone to afford a home.
And you genuinely think that reducing the number of available rental units would make things better for the overwhelming majority of people who currently can't afford to purchase a home outright?
Reducing the number of available rental units this way would increase the amount of dwellings available to purchase (and reduce prices). Do you think rental is the only way one can have a dwelling?