The average kinetic energy of the molecules in the hotter object decreases, while the average kinetic energy of the molecules in the cooler object increases. But when an object changes phase, its temperature does not change, even though heat is added or removed.