Roblox added a new Audio API update that is currently in beta. With this update, they introduced AudioPlayers, which should work the same as sounds except they need to be connected to an AudioEmitter with a Wire. In the official post about this new Audio API update, they say:
“Assign the AssetId property of the AudioPlayer to a suitable audio asset, and notice that its TimeLength and IsReady properties get filled in.”
However, when I do fill in the AssetId, the AudioPlayer’s TimeLength and IsReady properties don’t get filled in. It also does not play the audio ingame when testing or when playing the actual game.
Hm, when Enqu_1 replied “Try adding “rbxassetid://” before the Id”, I did try that and it didn’t work, but now it does for some reason. Well, it partly works. The IsReady property gets set to true and the TimeLength property gets set. However, when I try to play it, it doesn’t actually play anything.
I did close roblox studio and just started it back up again, so that might have fixed the problem with the properties, but it still doesn’t play the audio…
And I just tried it again and it didn’t fill in the properties until I deselected the AudioPlayer and selected it again.
The TimePosition property is also frozen until I select it. And when I do select it, it just instantly increases by approximately 0.1. Sometimes it’s 0.102 or 0.009 but always approximately 0.1.
After some testing I have found the problem. With Sounds, audios are played and directly outputted to the client. Audio Players do not output audio to the client, and instead require you to set up what to output using AudioDeviceOutput. In order to replicate how legacy sound works, you can create a part following the camera that contains an AudioListener and an AudioDeviceOutput. Add a wire from Listener to Output, and you should be able to hear sound.
Edit: You can actually just put the AudioListener and AudioDeviceOutput in the camera directly. No need for a part.
This doesn’t solve my issue [EDIT: It does]. I do not want to output it using an AudioDeviceOuput, as this does not play the sound spatially. I want it to emit from a certain part, so I am using an AudioEmitter.
Documentation for the AudioEmitter:
After testing it, it does seem to be an issue with the AudioEmitter, as the sound plays when using an AudioOutputDevice Instance, but not an AudioEmitter instance.
Ohh. I see I didn’t understand what you meant. I thought you meant directly playing it through the AudioDeviceOuput. I see you mean put that in the camera separately to capture the audio output by the AudioEmitter. Thank you for the answer.