Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 3 years ago
Edited 3 years ago

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?

0
Try doing it in a Local Script. PaleNoobs 37 — 3y
0
try using id ? felinoxon 0 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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.

Ad

Answer this question