This code does play a sound, and it can stop when the boolean value turns true, but, as the boolean value is based on whether you're within a certain part or not, you can simply step outside of the part before the task.wait finishes and the sound will continue to play
How would I make it so that the value check ignores the wait command and stops the loop immediately? Is there a more efficient way to make my object play a sound once per second until a certain boolean is set to true?
(Note: I am not experienced in coding at all)