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

My music script is playing multiple songs at a time. Help?

Asked by 7 years ago
Edited 7 years ago

My old music script that played Christmas songs is playing multiple songs at a time. How do I prevent / fix this?

01print('ran')
02local musicholder = script.Parent
03math.randomseed(tick());
04 
05local songList = {
06    musicholder:WaitForChild('CW'),
07    musicholder:WaitForChild('DeckDubstep'),
08    musicholder:WaitForChild('EhDe'),
09    musicholder:WaitForChild('JayKode'),
10    musicholder:WaitForChild('Ookay'),
11    musicholder:WaitForChild('SantaComes'),
12    musicholder:WaitForChild('XmasToMe'),
13    musicholder:WaitForChild('XmasBeats'),
14    --musicholder:WaitForChild('Song'),
15    --musicholder:WaitForChild('Song')
View all 38 lines...

1 answer

Log in to vote
0
Answered by 7 years ago

.Ended is really spooky and doesn't work the way it should on the server. You can either move the script to the client or make a table with the lengths of the sounds, like so:

1local songs = {songA, songB, songC}
2local songLengths = {120.5, 130, 100}
3 
4songs[songNum]:Play()
5wait(songLengths[songNum])
6songs[songNum]:Stop()
0
alright thanks but the issue i see with this is that the sound lengths are rounded and are very long decimals. ex. 34.41321321312312321321312312324567576465425234134143214324234234324234 Subaqueously 11 — 7y
Ad

Answer this question