Buying 2nd property before selling first home

Hello! I am looking to purchase a 2nd home and renting out my 1st home. If I cannot handle being a landlord and sell the 1st property AFTER buying 2nd home, will I end up paying capital gains tax since I didn't technically use the money to purchase 2nd home, or does it count that I use the money to pay down the 2nd property's loan? These properties are all within NJ. Thanks in advance!