Music: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>MR CORRECTATION
>MR CORRECTATION
(No difference)

Revision as of 17:15, 11 October 2008


Due to a recent update it seems that the browse feature no longer works with the sound ID.

Note that any audio files, music sound effects or otherwise are not supported by the Roblox Content Distrobution System fully. If not uploaded correctly or using a file from your computer, people visiting the server may not be able to hear your sounds. Sound uploading is not supported by ROBLOX at this time.


Music isn't a script, but it is a block that, most of the time, looks like a stereo. Search music in Free Models in Roblox Studio to get music. (Click Insert, then click on the pulldown bar, then click Free Models. Type "music" and click the search button. Click on the selection that you want.) Here is an example.

There are many kinds of music in ROBLOX. Music makes a place more exciting and entertains players. In most cases, many players will not hear it, the admins are currently working on this problem. Choose your music carefully. If you choose the wrong music, many people will not like it and probably leave or turn their volume down.

The Sound object works like a speaker, whatever brick you put it in will start putting out sound at that brick's location. If the brick moves, so does the sound.

If sound objects are placed in the Workspace, however, it acts like there is a giant speaker everywhere, no matter where you go in the level the sound will be very loud and very everywhere.

Be sure to test your place before with your computer volume a little louder than normal. Make the sound's volume at a level that won't make you go deaf and you can be sure that other people won't complain about it.

More examples are here: Music

You can easily take the music "out" of a Free Model jukebox and put it "into" a brick, once you have verified that a song that you like actually works in Roblox.

Scripting and Music

To get started, go to Insert -> Objects and click on the sound object.

Once that is inserted, look down at the properties box and name it anything you want, but make sure not to put a space in the name.

A little below the name in the properties box is a spot called SoundId. When you click the white box next to SoundId, a pulldown arrow appears. Click the pulldown arrow and press browse(THERE ISNT CURRENTLY A BROWSE OPTION ONLY A CLEAR ONE)(MR CORRECTATION WAS HERE). Look in the location you have the song saved, click it and press open once it is selected. This will put a code of letters and numbers into the SoundId box. Do not delete any of this code or the song will not work.

Go back to Insert -> Object, and click on the script object. Verify that the script object appears in the same place as the sound file. (Example: they both appear in Workspace.) You can name the script anything you want. A suggestion for naming it would be something that is related to the name of the song.

The script below is a very basic script to use and edit.

The Script

c = script.Parent.songnamehere:clone()
c.Parent = game.Workspace
c:play()

Where it says songnamehere, put the name of the sound object you inserted earlier.

You should also be very careful about songs you insert. Non-native songs to ROBLOX wont always work right, and can crash your computer. So DON'T upload them unless they work properly on your computer.

If you want the song to loop, click on the sound object in the explorer, then look down in properties and click the checkbox next to loop, if you only want the song to play once when the person enters, leave the loop box unchecked.

Keep in mind that most people can not hear the music in online mode, but there is a solution.

1) Create a separate account (or use your current account)

2) Designate a place and allow people to enter it in solo, you could call 
that place <I>username's music installer</I> for example.

3) Have your music here, and when people hear it in solo, they should be able to here it in online play.

4) If you want to create a new account for this, you could call it something along the lines 
of <I>usernamesinstaller</I>. That is just an example. Basically the place you put the song in 
is a music installer so that others can hear it.

5) Try to add a link to your music installer from the game that has the music in it, 
this will help people so they don't have to search for it.

Website Linking

Website linking apparently doesn't work. I would assume that ROBLOX simply downloads it from the website then uses it on the local temporary files instead of streaming it from that server constantly.

Creating a button

1) First create a button, which is a brick (for this instance). This is my button. 2) Now, select the button. Go to insert > Object > Sound.

Sound insertion

3) Now select sound file from the explorer (it should be inside the button), go to properties and select SoundId, and then browse. Select the sound file from your computer. This action will actually upload the file to the ROBLOX server.

Sound insertion

4) Now we have a sound. How can we make it play as soon as a ROBLOXIAN touches the button? First create a new script inside the button. Insert the following code:

debounce = false
function onTouched(hit) -- When the button is touched...
if debounce == false then
debounce = true
local s = Instance.new("Sound") -- Create a new sound file
s.Name = "Sound" -- Dont change this.
s.SoundId = "yourSoundIdGoesHere" -- SoundId! Type here yours.
s.Volume = 1 -- Volume. 1 is the strongest, you can change it to whatever you want.
s.Looped = false -- Change this to true if you want the sound to loop (not recommended)
s.archivable = false -- Dont touch.

s.Parent = game.Workspace

wait(0)

s:play() -- Play our new sound!
end
end

script.Parent.Touched:connect(onTouched)

5) Now we have a sound button; one problem, ROBLOX doesn't knows what sound to play. Remember the sound we created before, where we selected a file? Exit the lua editor, select the sound from the explorer and at its properties copy the SoundId! The soundId should be a long line of letters and numbers. Copy. Go back to the script, and search for "yourSoundIdGoesHere". Delete that, and paste in that area the SoundId we just copied.


You now have a sound button. Test your place. Each time your player touches the button you hear the sound.

Creating a sound trigger

This is more advanced. It's almost as before but you should know how to script and where to insert the correct line. Copy this:

local s = Instance.new("Sound")
s.Name = "Sound" -- Dont change this.
s.SoundId = "yourSoundIdGoesHere" -- The sound file.
s.Volume = 1
s.Looped = false 
s.archivable = false

s.Parent = game.Workspace

wait(0)

s:play()

Paste it into an event that you want to trigger the sound.

See Also

Roblox Recently Updated Music Catalog