The molecules gain or lose energy, the more energy these molecules have the easy it is for them to break the bonds holding them together, this is when you apply enough heat to a substance it changes from a solid to a liquid then from a liquid to a gas