So I moved on from a previous script that was me literally manually writing a loop for each song I have (I have 70 in total btw, which adds up to about 400 lines of repeated code lol)
And I moved onto this code:
local SongBool = workspace.WorkspaceScripts:WaitForChild("MusicList")
for _,Song in ipairs(SongBool:GetChildren()) do
if not Song:IsA("Sound") then continue end
end
-- Store the titles of each audio in a dictionary
local audioTitles = {
Audio1 = "Caleb Belkin - Life";
Audio2 = "Caleb Belkin - Water";
Audio3 = "Lakey Inspired - Saydee";
Audio4 = "peachy - falling for you (feat. mxmtoon)";
Audio5 = "The Deli - 5:32PM";
Audio6 = "atlas - defeated";
Audio7 = "wunsche - sunday vibes";
Audio8 = "(atlas, mt. fujitive) - discombobulated";
Audio9 = "(atlas, mt. fujitive) - back then";
Audio10 = "MrSirJohny_YT - s a y g o o d b y e";
Audio11 = "Idealism - time will tell";
Audio12 = "potsu - breakfast";
Audio13 = "eevee - better";
Audio14 = "GentleBeatz - Cold Night";
Audio15 = "potsu - another.wun";
Audio16 = "wun two - again";
Audio17 = "Elijah Who - with all your love";
Audio18 = "Engelwood - Crystal Dolphin";
Audio19 = "HOME - Resonance";
Audio20 = "Idealism - both of us";
Audio21 = "atlas - internet personas";
Audio22 = "Anna Yvette - Red Line";
Audio23 = "eevvee - old places";
Audio24 = "HM Surf - Trip to the Beach";
Audio25 = "90sFlav - Call me";
Audio26 = "H.1 - Return";
Audio27 = "jinsang - feelings";
Audio28 = "gnash - feelings faded";
Audio29 = "love-sadKiD - My Oxygen";
Audio30 = "eevvee - mist";
Audio31 = "atlas - in between";
Audio32 = "Jack Stauber - Buttercup";
Audio33 = "Jack Stauber - Coffee";
Audio34 = "atlas - chamomile";
Audio35 = "Kudasai - serenade";
Audio36 = "The Deli - 1:42AM";
Audio37 = "The Deli - Tyner pt. 2";
Audio38 = "Driver - The Eye of Truth";
Audio39 = "The Deli - Moonlight.";
Audio40 = "jinsang - affection.";
Audio41 = "sugi.wa - ctrl.";
Audio42 = "Tusken. X Philanthrope - Mr.Toast";
Audio43 = "The Deli - Breeze";
Audio44 = "Persona 5 Beneath the Mask";
Audio45 = "Jack Stauber - Dead Weight";
Audio46 = "WYS - Lone";
Audio47 = "j'san - waking up in the park";
Audio48 = "Gus Dapperton - Prune, You Talk Funny";
Audio49 = "j'san - i’m in love with u, sorry";
Audio50 = "SALES - renee";
Audio51 = "Elijah Who - Cozy";
Audio52 = "Elijah Who - Ends";
Audio53 = "two sleepy - bloomed (slowed)";
Audio54 = "potsu - oops";
Audio55 = "potsu - lovesick";
Audio56 = "Whitewoods - Beachwalk (Zen Remix)";
Audio57 = "broey. - paradise";
Audio58 = "Eddie Rohosy - Night ride";
Audio59 = "Idealism - don’t say a word";
Audio60 = "Elijah Who - We used to talk every night";
Audio61 = "TRA$H - A L O N E";
Audio62 = "Kupla - fell in love in a dream";
Audio63 = "Elijah Who - A Cute Date";
Audio64 = "Elijah Who - hello";
Audio65 = "mt. fujitive - sundown";
Audio66 = "Idealism - nagashi";
Audio67 = "Jovial - Limes";
Audio68 = "Jack Stuaber - two time";
Audio69 = "Elijah Who - I'm in love";
Audio70 = "Saib - Sakura Trees";
}
-- Continuously go through all the songs, playing them
wait(10) -- Load time
while true do
for _,Song in ipairs(SongBool:GetChildren()) do
if not Song:IsA("Sound") then continue end
game.workspace.JukeVibe.Sign.SurfaceGui.SongFrame.Song.Text = audioTitles[Song.Name]
Song:Play()
Song.Ended:Wait() -- Properly waits for the song to end instead of using wait()
wait(5) -- Time between songs
end
end
However, it seems to skip 7 songs, then play like normal, while only playing 1 song at the beginning when the server starts, then skipping the 7 perfectly fine sound objects in my SongBool folder.
boatbomber wrote this code for me, and I made some tweaks to remove the visualizer component because I had to do that local.
Are they missing from the songbool folder?
Are they missing from songbool:GetChildren()?
Is the continue section of the loop running when they skip over?
Are the songs properly ordered in workspace?
Do they ever play, just misordered, or do they never play at all like they dont exist?
I’m pretty sure that only runs if finds something is not a sound object, so that line shouldn’t be affected. Sorry I think I misunderstood for a moment.
I believe this may be another instance on Sounds attempting to play in-between loops? Sometimes, there’s the weird chance of Sounds not being able to play certain ID’s when they’re encased inside a loop
Maybe try this?
-- Continuously go through all the songs, playing them
wait(10) -- Load time
while true do
for _,Song in ipairs(SongBool:GetChildren()) do
if not Song:IsA("Sound") then continue end
game.workspace.JukeVibe.Sign.SurfaceGui.SongFrame.Song.Text = audioTitles[Song.Name]
if not Song.IsLoaded then
Song.Loaded:Wait()
end
Song:Play()
Song.Ended:Wait() -- Properly waits for the song to end instead of using wait()
wait(5) -- Time between songs
end
end
If this script still keeps skipping songs, then that’s more than likely the reason why
Yeah unfortunately this is true, and the script still skips the Audio2 - Audio9 songs. This is confusing, I just can’t see what’s wrong here. I appreciate the help
The fortunate thing about this though, is that there is a workaround
Although you’d need to resort to Cloning the Sounds & instead, but looking back at it again I believe it can be possible
Can you try this?
-- Continuously go through all the songs, playing them
wait(10) -- Load time
while true do
for _,Song in ipairs(SongBool:GetChildren()) do
if not Song:IsA("Sound") then continue end
game.workspace.JukeVibe.Sign.SurfaceGui.SongFrame.Song.Text = audioTitles[Song.Name]
local CloneSong = Song:Clone()
CloneSong.Parent = SongBool
CloneSong:Play()
CloneSong.Ended:Wait() -- Properly waits for the song to end instead of using wait()
CloneSong:Destroy()
wait(5) -- Time between songs
end
end
Are these 2 supposed to be different? And I would have to move the songs out of SongBool, and into a server backup folder and get the children there, which is fine. I’ll try it.
No, I can confirm that they are all there, and all the IDs are in there. I can literally play Audio1-9 manually. Why would Audio1 fail if it was playing before? X_X
I just noticed something that I believe is crucial. Turns out the regular code was working just fine, it was just going in order of what was shown in the explorer. Sadly, it’s not sorted by Number.
I just don’t know how to get it to recognize the proper order.