Why is this music system not working?

Unfortunately, that does not work, not sure why, getting no errors in the console…

Is the folder’s name called Music? Is it in ReplicatedStorage? Are the only childs “Sound” instance? If the answer is yes for all of them, try debugging it and see where the print() stops.

I think you forgot to make it wait for the song to end, I debugged it using print, it keeps looping very fast.

This fixed it:

local musicFolder = game.ReplicatedStorage:WaitForChild("Music"):GetChildren() -- getting the folder's sounds
local songObj = Instance.new("Sound", game.Workspace) -- creating a sound for everyone to hear
songObj.MaxDistance = "inf"
repeat wait()
print("1")	
for i = 1, #musicFolder do -- this will loop through the folder
		    local nowPlaying = musicFolder[i]
		print("2")
		    songObj.SoundId = nowPlaying.SoundId
		print("3")
		    songObj:Play() 
		print("4")
		wait(songObj.TimeLength)
	end
	print("5")
until not songObj.IsPlaying and false
-- script in ServerScriptService (server-sided)
1 Like

Oh, I forgot to add the wait(). I’m glad it works, have fun listening to your tunes!

1 Like