Please check with the Adult community on your parent's Visa status. If they are Green Card holder, they may be qualified. If they are Visitors, they may not be qualified.
Usually, the Adult communities are very strict about just the adults staying in the house and not their children or grand children, relatives etc,.
I assume you intend for both you and your parents to be on the Deed. I also assume that you are under 55. Here is another possibility - find out if space is still available in the adult community's Under 55 Allowance. If there is space left you may not have an issue.
Absolutely legal. A more important question would be how they are purchasing the home If it is with cash, it is simple. If using financing, it will depend on their status in the US. There are loan programs for non-citizen purchasers depending on credentials. If you contact me I can provide you with some lenders that have helped other non us citizen clients of mine purchase homes in the US.