View difference between Paste ID: 3B8a1PD9 and NP5cXBuC
SHOW: | | - or go back to the newest paste.
1
-- [FE] Simple Music Player
2
LPlayer = game:GetService('Players').LocalPlayer
3
4
function PlaySound(id)
5
    local b = Instance.new('Sound', workspace)
6
    b.SoundId = 'rbxassetid://' .. id
7
    b:Play()
8
    repeat wait(1)        
9
    until
10
    LPlayer.Chatted:Wait() == ":stop"        
11
    b:Stop()
12
    b:Destroy()    
13
end
14
15
LPlayer.Chatted:connect(function(msg)
16
    if msg:sub(1,6) == ":find " then
17
        local b = game:HttpGet("https://search.roblox.com/catalog/json?SortType=Relevance&ResultsPerPage=1&Category=Audio&Keyword=" .. msg:sub(7) .. "/", true)
18
        local a = b:match('Id"+%S+,'):match('%d+')
19
        PlaySound(a)
20
    end
21
end)