I took the tree out of the pot and alot of the roots are rotting i'm not sure what to do pleeeeease advise.
Most usually, If the roots are rotting on something like this, it would indicate that too much water was the culprit. If any of the stem is still solid, chop it into sections, (of at least 4 nodes per) and just start new ones.
yes, you could do as chuck said. you could also trim off the rotted areas of the roots and then repot it in fresh soil. you would only be able to do this if the basic/center of the root ball is in good shape. if it's not, then, i'd lop of all the roots and stick the cane right into the soil and it'll re-root itself. or you could create multiple plants by using chuck's idea. if you can post a pic of the roots, that would be helpful. if you can get a pic up, hold off doing anything to the plant until we can get a look at it.