I would recommend using a Local Script to fix your problem.
There might be a problem with the script's ability to read the sound's TimeLength property. To fix this, use a local script.
"But where would I put the Local Script?"
I would suggest putting the Local Script in StarterPack. You could also put it in StarterGui or even ReplicatedFirst. However, StarterPack will be the one I use in my example.
"But what would I have to change?"
Not much actually. You would have to move the script to StarterPack, and change the script into a Local Script, along with a few other changes.
"Will it be hard?"
Nah.
Change the script into a Local Script and put it into StarterPack.
local songs = {'DeathOfABachelor', 'DontThreatenMeWithAGoodTime', 'Focus', 'IntoYou', 'MrsPotatoHead', 'MyHouse', 'No', 'PityParty', 'Radioactive', 'WorkFromHome', 'iWriteSinsNotTragedies', 'Work', 'StressedOut'}
for i=1,#songs do
local sound = script.OST:findFirstChild(songs[i])
sound:Play()
wait(sound.TimeLength)
end
Now we have access to some sound properties that would otherwise be unobtainable. We'll be waiting for the event Ended to fire from the sound in place of line 7 in the script above.
local songs = {'DeathOfABachelor', 'DontThreatenMeWithAGoodTime', 'Focus', 'IntoYou', 'MrsPotatoHead', 'MyHouse', 'No', 'PityParty', 'Radioactive', 'WorkFromHome', 'iWriteSinsNotTragedies', 'Work', 'StressedOut'}
for i=1,#songs do
local sound = script.OST:findFirstChild(songs[i])
sound:Play()
sound.Ended:wait()
end
You have to wait for OST to load using WaitForChild, like so,
local songs = {'DeathOfABachelor', 'DontThreatenMeWithAGoodTime', 'Focus', 'IntoYou', 'MrsPotatoHead', 'MyHouse', 'No', 'PityParty', 'Radioactive', 'WorkFromHome', 'iWriteSinsNotTragedies', 'Work', 'StressedOut'}
for i=1,#songs do
local sound = script:WaitForChild("OST"):FindFirstChild(songs[i])
sound:Play()
sound.Ended:wait()
end
I hope I helped. If I did, remember to accept my answer. It helps a lot!
Good Luck!
3 comments
I edited my answer.
Ok
Why did you un-accept my answer? I answered your question didn't I :/