I tried to make it so that you can only hear music if you are in a certain box
function Music()
script.Parent:Play()
wait(script.Parent.Music.TimeLength)
end
function MusicStop()
script.Parent:Stop()
end
script.Parent.Parent.Touched:connect(Music)
script.Parent.Parent.TouchEnded:connect(MusicStop)
Troubles: There are no error reports in the ouput box, but the music doesn't play when I'm in the box

6 comments
Use prints to see where the script stops.
TouchEnded can be very unreliable. And you're handling the audio on the server so if someone else were to stop touching it then the music would stop even if you're still in it. Handle the audio on the client and I suggest using magnitude to detect whether or not the player is within distance.
'TouchEnded' triggers anytime a player moves, because 1 of their feet lift up for the slightest second, ended the touch. I would recommend putting parts all around this part you're stepping on, (union if you want to), and put the second half of your script into that union/parts.
I'm not sure what you're trying to do, why do you have wait(script.Parent.Music.TimeLength) with nothing after it?
they should deprecate touchended. With alot of this, as stated earlier, it can be very unreliable
How would I use magnitude to find whether or not a player is in the box?