blox_YT

Music script(WORKING 2018)

Jul 24th, 2018
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. --Settings--
  2.  
  3. song_ID = {178594872}
  4.  
  5. randomizer = false -- set to true is a random number, set to false and it is in order
  6.  
  7. Wait_Time = 120 -- 120 is the max time for a sound/song. Add 5 seconds if you want a buffer between songs
  8.  
  9. inc = .05 -- this is the increment of which the volume increases/decreases for fade in/out.
  10.  
  11.  
  12.  
  13. --functions and IDs--
  14. asset_ID = "http://www.roblox.com/asset/?id="
  15. function choose(tab) local obj = tab[math.random(1,#tab)] return obj end
  16. function play(s) if s:IsA("Sound") then local o = s.Volume s.Volume = 0 s:play() for i = 0,o,inc do wait() s.Volume = i end s.Volume = o end end
  17. function stop(s) if s:IsA("Sound") then local o = s.Volume for i = o,0,-inc do wait() s.Volume = i end s:stop() s.Volume = o end end
  18. song = Instance.new("Sound",workspace) song.Name = "TigerCaptain's Music Player"
  19.  
  20.  
  21. --loop--
  22. counter = 1
  23. if #song_ID > 0 then
  24. while true do
  25. wait()
  26. if randomizer then song.SoundId = asset_ID..""..choose(song_ID) else song.SoundId = asset_ID..""..song_ID[counter] end
  27. play(song)
  28. wait(Wait_Time)
  29. stop(song)
  30. if counter >= #song_ID then counter = 1 else counter = counter + 1 end
  31. end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment