Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How Do I Add Music To My Game??

Asked by 10 years ago

Please im trying to see how to add music to my game im making.

4 answers

Log in to vote
1
Answered by 10 years ago

All of the above are kinda wrong

function onPlrEntered(newPlr)
wait(2)
Hal = Instance.new("Sound",  game.Workspace)
Hal.Name = "Hal"
Hal.SoundID = "www.roblox.com/assest/?id=152315450" -- Narwhals song :3
Hal:Play()
if game.Workspace.findFirstChild("Hal").Volume == 0.5 then
game.Workspace.Hal.Volume = 1
else
print = ("Doing good")
if script.Enabled = true then
game.Workspace.Hal.SoundId = "www.roblox.com/assest/?id=152315450"
else
print = ("Script is done")
end
end
end

This might work

Ad
Log in to vote
0
Answered by
Sublimus 992 Moderation Voter
10 years ago

Refer to this wiki post on how to implement Audio in your game:

http://wiki.roblox.com/index.php?title=Audio

Log in to vote
0
Answered by 10 years ago

In order to make the audio play in game, it requires a few things. 1) Studio 2) Music ID 3) And a little, or small understanding.

Ok, first things first, you go to your place on 'Edit' mode, in studio. If you have the new Studio Layout, click on 'VIEW', and then click 'Explorer' and 'Properties'. After you have done that, please right click 'Workspace' below the 'Explorer' properties. Then move your mouse over to 'Insert Basic Object' and insert 'Sound'. Leave the sound in the workspace, and do NOT rename it.

In order for you to get the sound ID, you need to look right at the top of the page, of an audio. I shall use one of my latest audios as an Example; http://www.roblox.com/Secondtunez-Feel-So-Blue-item?id=153602084. Now you see, this at the end. "id=153602084", I would like you to go to your desired audio, and select ONLY the ID of it, like this "153602084". Please paste it in a notepad or something, as you will need it later. Ok, now go back to studio, and click on the newly inserted 'Sound', and look at 'Properties' below 'Explorer'. I would like you to look for 'SoundId'. Please copy this, and paste it into the text box next to it, and hit enter.

http://www.roblox.com/asset/?id=

Now, going back to the notepad, copy the numbers, and go back to Studio, and go back to 'SoundId' and add the ID at the end, next to "asset/?id=". The whole thing shall look like http://www.roblox.com/asset/?id=153602084, or whatever ID you had. (I am using my example ID). Once again, hit enter.

You are almost done here. Now, right click 'Explorer' again, and move your mouse to 'Insert Basic Object' and choose 'Script'. Right click the newly inserted Script, and name is Music. Next. Double click 'Music' and then remove

print 'Hello world!'

Then, paste this script in.

wait(30)
game.Workspace.Sound:Play()

In order to make the music loop, click on 'Sound' and scroll to the bottom. You should see a checkbox saying "Looped". Please click it, so it has a little tick in the box.

That about does it, if you have any more problems, please PM me on ROBLOX, my name is DurstAuric.

Log in to vote
-3
Answered by 10 years ago

Create a sound.

s = Instance.new("Sound", Workspace)
s.Name = "hey"
s.Volume = 1
s.SoundId = "www.roblox.com/asset/?id=soundidhere"
s:Play()

Answer this question