I’ve never really utilised sounds in my games previously (I have always played Roblox muted and just listened to my own music) but I want to start adding in sound effects and music, etc. First problem I’ve run into is just getting simple background music playing. The sound is under SoundService. SoundService.RespectFilteringEnabled == true. And Sound.Playing == true.
When I play the game in studio it works, but when I play online it doesn’t. I definitely have Roblox unmuted, as I can hear my footsteps/jumping/etc.
Another question I have is how sounds work from server/client. I know in the past (long long time ago) I tried to implement sound effects, and when I played them they could be heard on every client instead of the client actually playing them. This was a long time ago, so I probably was using a server script which was most likely the problem. Just want to confirm though, sounds played from a LocalScript/Client run ModuleScript will only play on the client correct??
Reasons for why you can’t hear the sound can range from the sound not loading to the sound not being replicated to the client. That all depends on implementation and whatever pops up in the console.
You are correct that sounds could be heard from every client instead just one back then, and it’s really still true today, as SoundService.RespectFilteringEnabled is opt-in I believe.
With RespectFilteringEnabled on, this means that sounds played from the client can only be heard from that same client, as it says up there. Sounds played from the server seems like a different story, but I would think it replicates to all clients, since only playing the sound from the server seems very unintuitive.
In my personal opinion, there is not much to risk with RespectFilteringEnabled being off, since sounds are not all that gamebreaking and can be, at worst, very annoying.
On studio, the server and client audio plays in sync (which I think is weird). So it’s likely that you need to move the sound to Workspace to play as that’s the “physical” world where sound can be calculated.
There are known issues with the StarterCharacter SoundScript when RespectFilteringEnabled is off, not the property itself, unless that’s what you were referring to - which then that’s slightly off-topic.
Sounds don’t need to be in Workspace and there’s no such thing as “sound calculation”.
Yes. Sounds have an IsLoaded callback that returns whether the sound’s been loaded or not, as well as a Loaded event that fires when the sound is loaded. The SoundId is passed as a parameter.
If sounds aren’t playing for you, just move them to a different container maybe. I never put them directly in SoundService.