generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Can someone help with a music script?

Previous Thread :: Next Thread 
forgetaboutit24 is not online. forgetaboutit24
Joined: 22 Nov 2012
Total Posts: 8771
03 Apr 2017 01:04 PM
I know how to make a normal one, but how do you make it go

Song 1

Wait until it's done

Song 2

Wait until done

Song 3

What until done

Repeat
?
Report Abuse
Atavis is not online. Atavis
Joined: 10 Apr 2012
Total Posts: 1463
03 Apr 2017 01:06 PM
songs = {}

while true do
for _, v in pairs(songs) do
sound.SoundId = "rbxassetid://" .. v
repeat wait() until sound.IsLoaded
sound:Play()
wait(sound.Length)
sound:Stop()
end
end


112,768 slices of pizza and counting!
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
03 Apr 2017 01:09 PM
repeat wait() until sound.TimeLength >0 -- it starts at 0 sometimes and will skip tracks before it initializes them
wait(sound.TimeLength)
Sound:Stop()
Report Abuse
KingBobo23 is not online. KingBobo23
Joined: 02 Apr 2016
Total Posts: 265
03 Apr 2017 01:10 PM
Oh ya I've had a similar question to this. Also how do you randomize it?


Report Abuse
KingBobo23 is not online. KingBobo23
Joined: 02 Apr 2016
Total Posts: 265
03 Apr 2017 01:11 PM
And make a gui button for it to turn on and off.


Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
03 Apr 2017 01:11 PM
If the ID changes the track may very well retain its previous length for a split second (this happened to me a year or two ago)
If you run into errors with skipping and premature ending, try setting a variable outside of the loop equal to the last song's timelength, and repeat wait() until sound.TimeLength ~= oldTimeLength
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
03 Apr 2017 01:12 PM
To randomize the song, just pick a random one out of the table by saying
local songs {song1,song,2,song3,songEtc}
local song = songs[math.random(1,#songs)]
print(song)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image