Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. local Background = script.Parent.Background
  2.  
  3. function create(class, parent)
  4. local cre = LoadLibrary("RbxUtility").Create
  5. return function(properties)
  6. local inst = cre(class)(properties)
  7. inst.Parent = parent
  8.  
  9. return inst
  10. end
  11. end
  12.  
  13. local function shuffleTable(t)
  14. math.randomseed(tick())
  15. assert(t, "shuffleTable() expected a table, got nil")
  16. local iterations = #t
  17. local j
  18. for i = iterations, 2, -1 do
  19. j = math.random(i)
  20. t[i], t[j] = t[j], t[i]
  21. end
  22. end
  23.  
  24. local Songs = {
  25.  
  26. }
  27.  
  28. local SongNum = 0
  29.  
  30. local http = game:GetService("HttpService")
  31. local songs = http:JSONDecode(http:GetAsync("https://api.trello.com/1/lists/586598f76101622fdd6b2ccc/cards"))
  32. for _, v in pairs(songs) do
  33. if v.name:match(":") ~= nil then
  34. local s, f = string.find(v.name, ":")
  35. table.insert(Songs, string.sub(v.name, f + 1))
  36. game:GetService("ContentProvider"):Preload("rbxassetid://" .. string.sub(v.name, f + 1))
  37. print(Songs[#Songs])
  38. end
  39. end
  40.  
  41. shuffleTable(Songs)
  42.  
  43. while wait() do
  44. SongNum = SongNum + 1
  45. if SongNum > #Songs then
  46. SongNum = 1
  47. end
  48. Background:TweenPosition(UDim2.new(0.5, -140, 0, 10), "Out", "Back", 0.5)
  49. Background.CurrentSong.Text = game:GetService("MarketplaceService"):GetProductInfo(Songs[SongNum]).Name
  50. wait(5)
  51. Background:TweenPosition(UDim2.new(0.5, -140, -0.5, 10), "Out", "Back", 0.5)
  52. local Song = "rbxassetid://" .. Songs[SongNum]
  53. create("Sound", script.Parent.Parent) {
  54. Volume = 1;
  55. SoundId = Song;
  56. Name = "Music";
  57. }
  58. local Sound = script.Parent.Parent:FindFirstChild("Music")
  59. Sound:Play()
  60. wait(120)
  61. Sound:Stop()
  62. wait()
  63. Sound:Destroy()
  64. end
  65.  
  66. -- Copyrighted by Coltenlange111
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement