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

How can I make music play in my game?

Asked by 10 years ago

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

Log in to vote
2
Answered by
samfun123 235 Moderation Voter
10 years ago

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!

Ad
Log in to vote
1
Answered by 10 years ago

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.

0
Alright, thanks. SuperMushroom8 15 — 10y

Answer this question