You need to use the handle returned from PlaySoundFile() for StopSound(), for example this stops the levelup sound after half a second
/run local _, handle = PlaySoundFile(569593); C_Timer.After(.5, function() StopSound(handle) end)
Ketho17, it worked! Thank you so much.
So in my script I do not use /run, as far as I understand that is for macros only. Is that correct?
But what I did was set two local variables at the top (used them like normal global variables (gross, but what can you do), had them set by the function called when the QUEST_DETAIL event fired, and when the QUEST_FINISHED event fired, I used that same variable to stop the sound.
I was unaware that lua returned multiple variables, that is pretty neat. Anyway, thanks again for the help!