Advertisement
anphu04

Roblox Preview Songs

Jan 25th, 2019
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. -- 26/1/2019 by Valualty --
  2. tab = {}
  3. function getaudios(p)
  4.     for i,v in pairs(p:GetChildren()) do
  5.         if v:IsA("Sound") then
  6.             if v.TimeLength >= 20 then
  7.                 table.insert(tab,v)
  8.             end
  9.         end
  10.         getaudios(v)
  11.     end
  12. end
  13. getaudios(workspace) -- collect all the songs
  14. for i,v in pairs(tab) do -- stop all songs
  15.     v:Stop()
  16. end
  17. for i = 1, #tab do -- preview each songs for 2 seconds
  18.     if i > 1 then -- stops the previous song
  19.         tab[i-1]:Stop()
  20.     end
  21.     tab[i].TimePosition = tab[i].TimeLength/2
  22.     tab[i]:Play()
  23.     print(tab[i].Name.." ".. tab[i].SoundId)
  24.     wait(2)
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement