What happens to the temperature of a substance while it is changing state?

It can lose or gain energy or it forms the attractions between particles.