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

Script that should play music not working. How do I fix this?

I'm trying to make a script that is basically a playlist, but nothing happens. Here is the script.

while true do
script.Parent.Music1:Play()
wait(76)
script.Parent.Music1:Stop()
wait(0.1)
script.Parent.Music2:Play()
wait(61)
script.Parent.Music2:Stop()
wait(0.1)
script.Parent.Music3:Play()
wait(139)
script.Parent.Music3:Stop()
wait(5)

I have checked output, and all it says is that is: SoundService:PlayLocalSound only works on a client. How do I fix this?

2 comments

0

Try doing it in a Local Script.

0

try using id ?

1 answer

✓ Accepted answer

Start by creating a local script inside of StarterGui. Then, drag and drop all of the music inside of the script. Inside of the script, you can copy and paste this.

while true do 
	script.Music1:Play()
	repeat wait() until not script.Music1.IsPlaying
	script.Music2:Play()
	repeat wait() until not script.Music2.IsPlaying
	script.Music3:Play()
	repeat wait() until not script.Music3.IsPlaying
end

One of the reasons that your script may not be working is that you forgot to place an end for the 'while true do'. Using the 'IsPlaying' property of a sound, we can detect whether or not it is playing. Once the sound is finished, the 'IsPlaying' property of it is false. The script I've given you plays the music, detects when it has finished and plays the next one. It will repeat this playlist forever.

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