So I have a HP notebook and whenever I plug it in it works. But whenever I unplug it, it automatically dies. I noticed that th

Well, while many say they have a non-removable battery, they are (in most cases) removable. However, that said, they can be a real pain and complicated to do in some cases.

I have to say though it sounds like you do need a new battery. If it will only work when plugged in. If the device is under warranty, contact the manufacturer about the replacement. If it isn't under warranty any longer, then try a local tech.