Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

The music script will only play the first song. Can someone help me find the problem?

Only the first song is playing, none of the other songs are playing. Here's the link to the script: https://pastebin.com/d4dLg6Ji Picture line 4 as a straight line.

1 answer

✓ Accepted answer

Well that's because you can only set a single Id to a sound instance, to fix this we can loop over each id and create its own sound instance.

local sounds={"rbxassetid://144997651" ,"rbxassetid://279206904" ,"rbxassetid://279207008" ,"rbxassetid://3264735520" ,"rbxassetid://2943261339" ,"rbxassetid://212675193" ,"rbxassetid://2636748467" ,"rbxassetid://1617737624" ,"rbxassetid://3127092399" ,"rbxassetid://1616301680" ,"rbxassetid://160442087" ,"rbxassetid://3180460921"  }

for _,sound in pairs(sounds) do
	s = Instance.new("Sound")
	s.Pitch = 1
	s.Volume = 1
	s.SoundId = sound
	s.Looped = false
	s.PlayOnRemove = true
	s.Parent=workspace
	s:Play()
	repeat wait() until s.TimeLength>0
	wait(s.TimeLength)
end

5 comments

0

Once I put that script in, it started to play all the songs at once. I want them to be able to be played one-by-one.

0

@xAdxn edited answer

0

@DanzLua Samething is happening,

0

@xAdxn try now

0

Works now.

This discussion is preserved as it was. New answers, comments, and votes are closed.