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

Music player in server script service not working?

I have a normal script in Server Script Service and its supposed to play music when one ends, but it doesnt. The music doesnt play at all.

local music1 = script["Omae Wa Mou"]
local music2 = script["Naruto Opening 6 - No boy, No cry"]
local music3 = script["Naruto Shippuden - Sign (Opening 6) [English Full]"]

while true do
wait(113.592)
music1.Playing = false
music2.Playing = true
wait(91.219)
music2.Playing = false
music3.Playing = true
wait(91.715)
music3.Playing = false
music1.Playing = true
end

1 comment

0

Does the first song play?

2 answers

Hey there, try using the Play function instead. In this case you would do:

music1:Play()

and you can also use the Stop function, to the stop the other sounds. Also you put 113 seconds in the wait function, I think that's the main problem, try moving that line after the line 14. That's because you're making a loop and it runs from top to bottom.

1 comment

0

i put the 113 because at the begging the first son is playing.

Hello.

This is a quite easy fix, from what I can tell, you are trying to make a music play every time another song ends, and this is fairly simple. There is an RBXScriptSignal on ROBLOX named .Ended:Wait(). From this function, as in the name, it waits for the sound to stop playing. This will also make it so you won't be required to set a wait timer before starting to play another music. Your 2nd issue, is that you are using .Playing instead of :Play(). Using :Play(), will make it so the music will play, as in the name, and the function that you are using .Playing only applies to when the game starts.

Here is how you would make your script function properly:

local Music1 = script:FindFirstChild("Omae Wa Mou")
local Music2 = script:FindFirstChild("Naruto Opening 6 - No boy, No cry")
local Music3 = script:FindFirstChild("Naruto Shippuden - Sign (Opening 6) [English Full]")

while true do
Music1:Play()
Music1.Ended:Wait()
Music2:Play()
Music2.Ended:Wait()
Music3:Play()
Music3.Ended:Wait()
end

Hope this helps!

2 comments

0

doesnt work. no errors and music dont play, i have my volume on max

0

Make sure that you have the script placed in the correct spot. Also make sure that the songs are in the script, as it seems that's where they are in your script.

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