How to make a roblox song

10 min

While building a game, it’s easy to overlook the importance of sounds and music. Combined creatively, these can set an atmospheric or exciting tone, build suspense, and bring life to your game’s characters.

Audio Marketplace

A wide array of free-to-use audio can be searched for in the Toolbox.

  1. Click the Marketplace tab and select Audio from the menu.
How to make a roblox song
  1. Click the
    How to make a roblox song
    button and then, in the Creator field, type ROBLOX. Select the first option to sort results by legal, free-to-use audio published by Roblox
How to make a roblox song
  1. Optionally, adjust the Sound Length range to more easily distinguish between short sound clips and longer background music tracks.
How to make a roblox song
  1. Click the Apply button to save the sorting options.
How to make a roblox song
  1. Back in the main panel, search for music by typing keywords into the search field.
How to make a roblox song
  1. You can preview audio directly within Studio by clicking the play button in the corner of each listing. Once you locate an audio file to use, right-click the item and select Copy Asset ID (this ID will be required for playback testing below).

How to make a roblox song
1. Preview

How to make a roblox song
2. Right-click and copy ID

Uploading Custom Audio

You can upload custom audio for that you are certain you have permission to use, such as audio you make yourself or license from original creators. ID-verified creators can upload 100 free audio assets per 30 days, and unverified creators can upload 10 free audio assets per 30 days.

To upload one or more audio files in .mp3 or .ogg format:

  1. Open the Asset Manager.
  2. How to make a roblox song
  3. Click the Import button.
  4. How to make a roblox song
  5. Select the audio file(s) you want to import from your local machine and confirm.
  6. After the import process is complete, the audio item(s) will appear in the Audio folder.
  7. How to make a roblox song
  8. Right-click the item and select Copy ID to Clipboard (this ID will be required for playback testing below).
  9. How to make a roblox song

    Playing background music can be achieved through scripting under two useful patterns as follows:

    Audio Module

    To set up multiple songs and play any of them on command, you can implement a basic audio module.

    1. In the Explorer window, add a new ModuleScript to ReplicatedStorage named AudioPlayer.
    How to make a roblox song
    1. In the script, delete all existing lines and paste in the following code:

  1. Create a new LocalScript inside StarterPlayerStarterPlayerScripts.
How to make a roblox song
  1. In the script, delete all existing lines and paste in the following code. If desired, input different track names and audio IDs starting on line 8 (see Audio Marketplace or Uploading Custom Audio).

  1. Playtest the game and the track name specified on line 14 should play in the background.

To randomly shuffle background music, you can implement the following script which shuffles songs and avoids back-to-back repeats.

  1. In the Explorer window, create a new LocalScript inside StarterPlayerStarterPlayerScripts.
  2. Delete all existing lines and paste in the following code. If desired, specify different audio IDs starting on line 12 (see Audio Marketplace or Uploading Custom Audio).

Unlike background music, sounds will often originate from a specific place or object inside the game — the engine of a vehicle, the battle cry of an enemy, etc. However, they may also be played as an “ambient” sound like wind blowing or rain falling.

Positional Sounds

A sound placed in a BasePart or an Attachment will emit its sound from the part’s BasePart/Position|Position or the attachment’s Attachment/WorldPosition|WorldPosition. These are considered positional sounds and they share the following traits:

  • Volume — A positional sound will play louder as a player gets closer to its source.
  • Stereo — If one side of a player is closer to the sound’s source, the player’s corresponding speaker will be louder.

If the source part/attachment already exists in a place, you can add a positional sound directly within Studio:

  1. In the Explorer window, insert a new Sound object as a child of the source object.
How to make a roblox song
  1. Select the new sound object and, in the Properties window, locate its SoundId property. Enter rbxassetid:// followed by a valid audio ID, for instance rbxassetid://1847352423.
How to make a roblox song
  1. Toggle its Playing property on (sounds do not play automatically, so you must explicitly tell them to start playing).
How to make a roblox song
  1. Playtest the game and observe the sound’s qualities based on your character’s proximity to the source.

Ambient Sounds

Ambient environmental sounds like wind and thunder don’t need to be attached to a part because they come from all around the player. As such, these type of sounds can be played just like background music using the audio module above.

GUI Sounds

Sound effects for interactive GUI objects can be played using the audio module above. Instead of playing a sound immediately, however, you can hook it up to the GuiButton/Activated|Activated event listener for the button.

  1. In StarterGui, add a new ScreenGui, then create a new TextButton within it. If you’re unfamiliar with buttons and their basic options, see articles/Creating GUI Buttons|Creating GUI Buttons.
  2. Select the new button and insert a LocalScript.
How to make a roblox song
  1. In the script, delete all existing lines and paste in the following code. If desired, input a different sound name and audio ID on line 8.

  1. Playtest the game and you should hear the sound name specified on line 16 play when the button is activated.

Tags: