The usual place I double-check how to write things in Lil is the Lil: A Scripting Language page.
So, what you need is an If statement.
on click do
if checkbox.value
play["sound" "loop"]
end
end
(I called the audio tracking checkbox "checkbox" but please call it whatever your widget is called.)
If the button that's being clicked to play audio is the checkbox and you'd like music to turn off when it's unchecked you might write it like this:
on click do
if me.value
play["sound" "loop"]
else
play[0 "loop"]
end
end
Does this work for what you needed? I'm happy to give a different example if you have it set up in a different way.