I'm trying to get 3 audios to play on a loop but only one plays I thought I had it, can someone help?
Music Script (not sure whats wrong)
01 | local sound = Instance.new( "Sound" , workspace) |
02 | sound.Volume = . 05 |
03 |
04 |
05 | wait( 5 ) |
06 | sound.SoundId = "rbxassetid://" .. 536215322 |
07 | sound:Play() |
08 | sound.Ended:Wait() |
09 | sound:Destroy() |
10 | wait(. 05 ) |
11 | sound.SoundId = "rbxassetid://" .. 852278165 |
12 | sound:Play() |
13 | sound.Ended:Wait() |
14 | sound:Destroy() |
15 | wait(. 05 ) |
16 | sound.SoundId = "rbxassetid://" .. 531211690 |
17 | sound:Play() |
18 | sound.Ended:Wait() |
19 | sound:Destroy() |
20 | wait(. 05 ) |
Thanks for your time
-Species
You will have to create 3 sound objects or else it would just switch the sounds. Also, you are destroying sound so you can't play it anymore.
try this code;
01 | local sound 1 = Instance.new( 'Sound' , game.Workspace) |
02 | sound 1. Volume = 0.05 |
03 |
04 | local sound 2 = Instance.new( 'Sound' , game.Workspace) |
05 | sound 1. Volume = 0.05 |
06 |
07 | local sound 3 = Instance.new( 'Sound' , game.Workspace) |
08 | sound 1. Volume = 0.05 |
09 |
10 | wait( 5 ) |
11 | sound 1. SoundId = "rbxassetid://" .. 536215322 |
12 | sound 1 :Play() |
13 | sound 1. Ended:Wait() |
14 | sound 1 :Destroy() --Where u destroyed a sound |
15 | wait( 0.05 ) |
By creating 3 new sounds, all your problems are solved. If this helped then please accept answer.
01 | -- initializing 3 audio instead of just 1 |
02 | local sound 1 = Instance.new( "Sound" , workspace) |
03 | local sound 2 = Instance.new( "Sound" , workspace) |
04 | local sound 3 = Instance.new( "Sound" , workspace) |
05 | sound 1. Volume = . 05 |
06 | sound 2. Volume = . 05 |
07 | sound 3. Volume = . 05 |
08 | wait( 5 ) |
09 | sound 1. SoundId = "rbxassetid://" .. 536215322 |
10 | sound 1 :Play() |
11 | sound 1. Ended:Wait() |
12 | sound 1 :Destroy() |
13 | wait(. 05 ) |
14 | sound 2. SoundId = "rbxassetid://" .. 852278165 |
15 | sound 2 :Play() |
Now it should work. The thing is that you created only 1 audio instance and you destroyed that the moment the first audio stopped playing. This should work but if you want to make it shorter you can just make one sound audio and change the id the moment the song ends. Then play it right after inputting the next id.