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

I'm trying to get 3 audios to play I thought I had it, can someone help?

Asked by 7 years ago

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)

01local sound = Instance.new("Sound", workspace)
02sound.Volume = .05
03 
04 
05wait(5)
06sound.SoundId = "rbxassetid://"..536215322
07sound:Play()
08sound.Ended:Wait()
09sound:Destroy()
10wait(.05)
11sound.SoundId = "rbxassetid://"..852278165
12sound:Play()
13sound.Ended:Wait()
14sound:Destroy()
15wait(.05)
16sound.SoundId = "rbxassetid://"..531211690
17sound:Play()
18sound.Ended:Wait()
19sound:Destroy()
20wait(.05)

Thanks for your time

-Species

2 answers

Log in to vote
0
Answered by 7 years ago

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;

01local sound1 = Instance.new('Sound', game.Workspace)
02sound1.Volume = 0.05
03 
04local sound2 = Instance.new('Sound', game.Workspace)
05sound1.Volume = 0.05
06 
07local sound3 = Instance.new('Sound', game.Workspace)
08sound1.Volume = 0.05
09 
10wait(5)
11sound1.SoundId = "rbxassetid://"..536215322
12sound1:Play()
13sound1.Ended:Wait()
14sound1:Destroy() --Where u destroyed a sound
15wait(0.05)
View all 24 lines...

By creating 3 new sounds, all your problems are solved. If this helped then please accept answer.

0
Yeah pretty much the same as mine :p shakran 23 — 7y
0
xD, though I posted mine first. BlackOrange3343 2676 — 7y
0
use a loop User#5423 17 — 7y
0
How would I loop this? Unkn0wn_Species 20 — 7y
0
add while true do BlackOrange3343 2676 — 7y
Ad
Log in to vote
0
Answered by
shakran 23
7 years ago
01-- initializing 3 audio instead of just 1
02local sound1 = Instance.new("Sound", workspace)
03local sound2 = Instance.new("Sound", workspace)
04local sound3 = Instance.new("Sound", workspace)
05sound1.Volume = .05
06sound2.Volume = .05
07sound3.Volume = .05
08wait(5)
09sound1.SoundId = "rbxassetid://"..536215322
10sound1:Play()
11sound1.Ended:Wait()
12sound1:Destroy()
13wait(.05)
14sound2.SoundId = "rbxassetid://"..852278165
15sound2:Play()
View all 23 lines...

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.

0
Thank you both for you answers! Unkn0wn_Species 20 — 7y

Answer this question