Cricket zte grand x and it will not stay on unless it is connected to the charger

Solution
Sounds like your battery is no longer holding a charge correctly. The quick and (mostly) inexpensive way to address that is to get a new battery for your phone.