My battery icon has x in it My MacBook Pro 15" battery has a black X in the battery icon and the indicator lights on the side do not light up when button is pressed. What could be the problem? It runs fine when plugged in
Most likely the battery has died or is no longer being recognized by the system. To verify it is not the latter Apple has a KB article that will help with resetting the SMC. 

If it is the former it's time to replace the battery. If you are under warranty take it to a nearby Apple store. If not they can still do the repair but it will cost you. Depending on the model you have replacing the battery can be trivially easy (open the latches on the bottom and pop out the battery) to "just give up and cry yourself to sleep."

More info on your make and model would help us determine where your hardware falls in that spectrum and how many cycles you might expect on your battery before it disconnects itself like you have noticed.