Treat Sounds as a First Class Citizen

I am trying to add background music to my game, which seems like it should be an easy task.

This is the current workflow, as far as I can tell (because it is not documented in the wiki):

  1. Go to DEVELOP page on the WEBSITE.
  2. Upload sound
  3. Get the AssetID for the sound
  4. Open Studio
  5. Go to Model -> Advanced Objects -> Sound
  6. Set the SoundID in the Sound to the AssetID you copied before
  7. Go to Model -> LocalScript
  8. Put a local script in the StarterGui (where else?!)
  9. Write code to make the sound play when the script runs which will happen whenever the character spawns

This is awful.

I’ve also noticed that if you somehow manage to find the sound library in Studio (by dark magic) and point your Studio browser to an asset like https://www.roblox.com/Spitfire-item?id=129490596, the Play buttons do not work in Studio. So I have to go to the website to browse sounds I might want to add to my game.

Proposal:

Make sound upload work like image upload from Studio (actually make it better, because I should be able to upload a sound from the SoundID property in property manager).

Create a BackgroundMusic service. Let me put folders in there. Make a property: BackgroundMusicService.CurrentFolder. Automatically shuffle the sounds in this folder as a playlist.

13 Likes

I agree the process should be more straightforward. There are a lot of casual builders who just want to add some simple background music to their game, but they have no idea how to do all of this. Background music is probably one of the most frequent things I get asked how to do.

Can’t say I agree with the idea of a BackgroundMusicService, the rest of it however is on point. What I would say is perhaps a folder within SoundService called BackgroundSounds or something of the sort may be a better idea.

Yes, agreed. Also you can put local scripts in PlayerScripts which won’t reset each time the player dies. So that’s one less issue, but the other points are valid.

I am not sure how it works currently, but at one point every time the play died you needed to manually restart the background music. Is that still true?

To prevent music in the gui folder from resetting:
game.StarterGui.ResetPlayerGuiOnSpawn = false

Other ways to persist music through respawning:

  • put it in game.Players.LocalPlayer.PlayerScripts
  • if using FilteringEnabled, you can put it in Workspace (won’t share to other players)
1 Like

To overcome this problem I’ve been putting a music folder in each Player when they join. Tracks played from here don’t reset on death.

Maelstronomer’s solutions also work well.

Thanks for the information. If I ever knew that I forgot about it.

It’s gross that developers need to know about all of these secret switches. How did you find out about these?

1 Like

ResetPlayerGuiOnSpawn was a big deal. Not sure it got a blog post.

PlayerScripts was an even bigger deal because of custom camera/movement controls and as a persistent local container.

I can’t find these mentioned on the blog. They were probably only mentioned briefly in a stream. I found these out when they were added because of the Changelog and the dev forum.

Would be convenient if these 2 pages had the info mentioned on this thread:
http://wiki.roblox.com/index.php?title=Sounds
http://wiki.roblox.com/index.php?title=API:Class/Sound

I agree, sounds should have rights too!

1 Like