when it is plugged in, what does it say about the battery? you should have a battery icon in lower right, it should give you % charged.
how old is the laptop? batteries deteriorate over time, it's not uncommon for a battery that once powered a laptop for 2 hours when new to barely hold out for 30 minutes 5 years later.
replacement batteries aren't cheap, best to make sure it is indeed a dead battery before throwing money at buying a new one.