Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local HS = game:GetService('HttpService')
- local musicTable = HS:JSONDecode(game:HttpGetAsync('https://epicgameronmylevel696969.000webhostapp.com/Data.json'))
- function testContentDeleted(songid)
- local sound = Instance.new("Sound", game:GetService("Lighting"))
- sound.SoundId = "rbxassetid://"..songid
- sound.Volume = 0
- sound:Play()
- wait(0.1)
- if sound.TimeLength < 0.05 then
- sound:Destroy()
- return false
- else
- sound:Destroy()
- return true
- end
- end
- function updateMusicTable()
- for i,v in pairs(musicTable) do
- if testContentDeleted(musicTable[i].SoundId) == false then
- musicTable[i] = nil
- end
- end
- end
- function changeMusicTable(Index, Name, SoundId)
- updateMusicTable()
- if musicTable[Index] then
- if SoundId then
- musicTable[Index].SoundId = SoundId
- end
- if Name then
- musicTable[Index].Name = Name
- end
- end
- end
- function addMusicTable(Name, SoundId)
- updateMusicTable()
- local Index = #musicTable + 1
- musicTable[Index] = {}
- musicTable[Index].Name = Name
- musicTable[Index].SoundId = SoundId
- end
- function removeMusicTable(Index)
- updateMusicTable()
- table.remove(musicTable, Index)
- end
- function playMusic(num)
- updateMusicTable()
- if musicTable[num] then
- game:GetService("Players"):Chat(":music ".. tostring(musicTable[num].SoundId))
- print('Now playing:', musicTable[num].Name)
- return musicTable[num].Name
- end
- end
- function getMusic()
- updateMusicTable()
- for i=1, #musicTable do
- if musicTable[i] then
- wait()
- print("You can play", tostring(musicTable[i].Name), "- Just use number:", i)
- end
- end
- end
- local prefix = ":"
- game:GetService("Players").LocalPlayer.Chatted:Connect(function(msg)
- if string.sub(msg, 1, 6) == (prefix.."play ") then
- if musicTable[tonumber(string.sub(msg, 7))] then
- playMusic(tonumber(string.sub(msg, 7)))
- end
- end
- end)
- game:GetService("Players").LocalPlayer.Chatted:Connect(function(msg)
- if string.sub(msg, 1) == (prefix.."getmusic") then
- getMusic()
- end
- end)
- game:GetService("Players").LocalPlayer.Chatted:Connect(function(msg)
- if string.sub(msg, 1) == (prefix.."getmusichelp") then
- print([[*Make sure you have admin*
- :getmusic - gets all of the playable music
- :play [number] - plays a certain song from the playable music list
- ]])
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement