You mean while the charger is connected you are not able to operate the S4 ??
If the battery is falling instantly, please check the battery health. Mine had a little bulging feel to it so I got replace a couple of years back and its working fine now. Also, there are apps on the play store to check the health, well, I haven't used it by my self so can't say how good they are.