Music not playing and idk why

Yo wassup y’all, so uhm i’ve been trying to make a code to make a playlist on roblox you feel me.
And uh the music ain’t playing unless i enable the playing proprety in the sound. and when its enabled it doesn’t change the song id.

Here’s a screen shot for y’all btw
Capture

and here is the code its basic alr

local m = script.Parent
while true do
	m:Play()
	m.Ended:Wait()
	wait(2)
	m.SoundId = "rbxassetid://7029099738"
	m:Play()
	m.Ended:Wait()
	wait(2)
	m.SoundId = "rbxassetid://7023598688"
	m:Play()
	m.Ended:Wait()
	wait(2)
	m.SoundId = "rbxassetid://7029017448"
	m:Play()
	m.Ended:Wait()
	wait(2)
	m.SoundId = "rbxassetid://7029024726"
end

And thanks!

You are calling the Play() function immediately after changing the sound ID. The actual length of the sound is initially 0 as the sound data is not loaded yet. Because you are changing the sound ID in a loop, you should just create individual sounds for each sound ID and just play those in order:

local sounds = game:GetService("SoundService"):GetChildren()
while wait(2) do 
     for i,v in pairs(sounds) do
          v:Play()
          v.Ended:Wait()
          wait(2)
     end
end
2 Likes

The reason why the audio will not play is because your ServerScript is in SoundService, ServerScripts can only run in Workspace or ServerScriptService

3 Likes

welp i didn’t know about that thx man!

Put your script inside ServerScriptService, instead of SoundService. Then you can just refer to it through there, in the script instead.

1 Like