I am trying to :Play() an audio in a function (that is called via ProximityPrompt.Triggered) and it does not work. If I do that anywhere else in the Script, it plays as expected.
This is insanely strange, because I have another audio in that exact same function and it plays as expected.
And no, this is not because something is happening with the audio instance itself. As I said, it is playing perfectly fine anywhere else in the code.
Also, when I print out if the not working audio’s IsPlaying, it returns true?
Print the isPlaying before you actually play the sound, see what prints.
You can also try to disable the proximity after the sound has been instructed to play, it could be because the function stops when it’s actual proximity prompt disables.
Are you using the same variable names for both audios? That’s the only thing which came into my mind when you mentioned that it plays as expected anywhere in the code. Maybe you are double playing the same audio and then that same audio returns true because it is really playing.
Sometimes, it can glitch out. I have the situation where one attack spam thunder bolts which play sounds but the main attack which has one sound doesn’t play. Maybe you can report it as a bug? I am not sure
Where is the sound located? Is it located in a place that would allow sound to be played (within a part in the workspace, In the SoundService)? You’ll have to parent the audio to a place capable of producing sound.