Try these instead:
To play:
if (GetBoolean(record, "on")) {
msg ("It is already playing.")
} else {
SetObjectFlagOn (record, "on")
play sound ("soundbyte here.mp3", false, false)
msg ("You listen to the recording for a bit. A lovely piece of clasical music.")
}
To stop:
if (GetBoolean(record, "on")) {
SetObjectFlagOff (record, "on")
stop sound
msg ("You place record back in its sleeve.")
} else {
msg ("It has already stopped.")
}
The way you have the code in yours, you are always setting the flag before you check the flag.
SetObjectFlagOn (record, "on")
if (GetBoolean(record, "on")) {
It will never be anything other than what you set it to. You need to check before setting, to see what it already is.