Tasha5266
|
  |
| Joined: 23 Jun 2012 |
| Total Posts: 9077 |
|
|
| 01 Jun 2017 03:35 PM |
| I was wondering if anyone was aware on how to add multiple audios to a game. Have a list of audios place one after another, help would be greatly appreciated I'm pretty stuck x.x |
|
|
| Report Abuse |
|
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 01 Jun 2017 03:38 PM |
| It's no more difficult to add multiple Sounds than it is one so I'm guessing there must be more to it. Can you explain a little more about what you're trying to accomplish? |
|
|
| Report Abuse |
|
|
Tasha5266
|
  |
| Joined: 23 Jun 2012 |
| Total Posts: 9077 |
|
|
| 01 Jun 2017 04:00 PM |
| I know I can add the regular audio in-game, however would it constantly play back to back (different songs). So could I just add all the songs to the audio or would I need a scripter in order to have them play & repeat in order? It's pretty basic I know, but I'm not sure if it's as simple as I'm thinking, dumb I know, lol. |
|
|
| Report Abuse |
|
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 01 Jun 2017 04:18 PM |
It's probably best to script their order if you want them to always play back to back in a specific order. The script, however, wouldn't need to be very complex at all.
Say you had a folder in the workspace named "Audio" and had a couple sound files in there (sound1 and sound2). The script could be as simple as this:
workspace.Audio.sound1:Play() workspace.Audio.sound2:Play()
But these sounds would play overlapping... To fix this you would need to check if the first sound had finished playing before starting the second sound. There are a couple ways to do this actually. One way is to handle the Ended event of the Sound class. i.e.
workspace.Audio.sound1:Play() workspace.Audio.sound1.Ended:connect(function() workspace.Audio.sound2:Play() end)
These are only just examples of course. One of the great things about programming is there is no one way to do something.
Now all the code above would play both sounds globally(for everyone) if you want 3D positional sounds you have to set the sound files parent to a Part or UnionOperation. Or if you want to play a sound only for one player there is a method to do so via the SoundService(PlayLocalSound()) and probably other ways as well.
This is a link to the wiki article for the Sound class wiki.roblox.com/index.php?title=API:Class/Sound
I'm sorry if this confused you even more... I'm not great at explaining things. if you could give a more specific example of what you're wanting someone might even offer up some code... Depends. |
|
|
| Report Abuse |
|
|