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

How can I make music play in my game?

Cause whenever I do this?

while true do
wait(1)
script.Music.Pitch = 1
script.Music:play()

end

it keeps repeating the music over and over and over again?

And it sounds like a herd of kids trying to sing at the same time but failing?

Help?

2 answers

If you are trying to make the music loop just remove the while true do and set the Looped property of the music to be true.

game:GetService("ContentProvider"):Preload(script.Music.SoundId)
script.Music.Pitch = 1
script.Music:Play()
script.Music.Looped = true

if you don't want the music to loop just remove the script.Music.Looped = false

game:GetService("ContentProvider"):Preload(script.Music.SoundId)
script.Music.Pitch = 1
script.Music:Play()

If you have any questions, concerns or just need some help with this PM me on ROBLOX!

Just do

script.Music.Pitch = 1
script.Music:play()

No need for a loop in your script. Just set the Music's Looped *property *to true.

1 comment

0

Alright, thanks.

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