Chosen Solution

I can only use my tablet (Galaxy Tab SM-T530) when is charging because while it is not charging it keeps on crashing and not booting

Battery needs to be replaced. iFixit does not have the guide but sure you can find something online. When batteries are not performing well you will get some of the problems mentioned in your question!

This is most likely a problem with your battery, I wouldn’t say it’s crashing, It’s run out of Battery. If you can take it off charge once it’s running, that’d be strange. Also I recommend if that fails, First, try replace the charger, if that does the samething. Sorry to say but you might have to replace that battery. Goodluck :)