Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local Player = Players.LocalPlayer
- local RunService = game:GetService("RunService")
- local SoundService = game:GetService("SoundService")
- if not Player then
- Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
- Player = Players.LocalPlayer
- end
- repeat
- task.wait()
- until Player and Player:IsA("Player") and Player.PlayerGui
- local isScanning = false
- local foundIds = {}
- local trackedSounds = {}
- local history = {}
- local currentPlaying = nil
- local currentSound = nil
- local historyVisible = false
- local scanLoop = nil
- local updateCooldown = 0
- local gui = nil
- local function copyToClipboard(text)
- if setclipboard then
- setclipboard(text)
- elseif toclipboard then
- toclipboard(text)
- elseif syn and syn.io then
- syn.io.writeclipboard(text)
- elseif write_clipboard then
- write_clipboard(text)
- end
- end
- local function getCleanId(soundId)
- if not soundId or soundId == "" or soundId == "rbxasset://" or soundId == "rbxasset" then
- return nil
- end
- local id = string.match(soundId, "rbxassetid://(%d+)")
- if id then return id end
- id = string.match(soundId, "(%d+)")
- return id or soundId
- end
- local function createGUI()
- local oldGui = Player.PlayerGui:FindFirstChild("MusicScanner")
- if oldGui then oldGui:Destroy() end
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "MusicScanner"
- screenGui.Parent = Player.PlayerGui
- screenGui.ResetOnSpawn = false
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 400, 0, 500)
- frame.Position = UDim2.new(0.5, -200, 0.5, -250)
- frame.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- frame.BackgroundTransparency = 0
- frame.BorderSizePixel = 2
- frame.BorderColor3 = Color3.fromRGB(255, 255, 255)
- frame.Active = true
- frame.Draggable = true
- frame.Parent = screenGui
- local title = Instance.new("TextLabel")
- title.Size = UDim2.new(1, 0, 0, 35)
- title.Position = UDim2.new(0, 0, 0, 0)
- title.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
- title.BackgroundTransparency = 0
- title.BorderSizePixel = 2
- title.BorderColor3 = Color3.fromRGB(255, 255, 255)
- title.Text = "MUSIC SCANNER"
- title.TextColor3 = Color3.fromRGB(255, 255, 255)
- title.TextScaled = true
- title.Font = Enum.Font.GothamBold
- title.Parent = frame
- local topPanel = Instance.new("Frame")
- topPanel.Size = UDim2.new(1, 0, 0, 35)
- topPanel.Position = UDim2.new(0, 0, 0, 37)
- topPanel.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- topPanel.BackgroundTransparency = 0
- topPanel.BorderSizePixel = 2
- topPanel.BorderColor3 = Color3.fromRGB(255, 255, 255)
- topPanel.Parent = frame
- local status = Instance.new("TextLabel")
- status.Size = UDim2.new(0.45, 0, 0.8, 0)
- status.Position = UDim2.new(0.02, 0, 0.1, 0)
- status.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- status.BackgroundTransparency = 0
- status.BorderSizePixel = 1
- status.BorderColor3 = Color3.fromRGB(255, 0, 0)
- status.Text = "STOPPED"
- status.TextColor3 = Color3.fromRGB(255, 0, 0)
- status.TextScaled = true
- status.Font = Enum.Font.Gotham
- status.Parent = topPanel
- local counter = Instance.new("TextLabel")
- counter.Size = UDim2.new(0.45, 0, 0.8, 0)
- counter.Position = UDim2.new(0.53, 0, 0.1, 0)
- counter.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- counter.BackgroundTransparency = 0
- counter.BorderSizePixel = 1
- counter.BorderColor3 = Color3.fromRGB(255, 0, 0)
- counter.Text = "FOUND: 0"
- counter.TextColor3 = Color3.fromRGB(255, 0, 0)
- counter.TextScaled = true
- counter.Font = Enum.Font.Gotham
- counter.Parent = topPanel
- local listFrame = Instance.new("Frame")
- listFrame.Size = UDim2.new(1, 0, 0, 385)
- listFrame.Position = UDim2.new(0, 0, 0, 74)
- listFrame.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- listFrame.BackgroundTransparency = 0
- listFrame.BorderSizePixel = 2
- listFrame.BorderColor3 = Color3.fromRGB(255, 255, 255)
- listFrame.Parent = frame
- local scroll = Instance.new("ScrollingFrame")
- scroll.Size = UDim2.new(1, 0, 1, 0)
- scroll.Position = UDim2.new(0, 0, 0, 0)
- local scrollPadding = Instance.new("UIPadding")
- scrollPadding.PaddingLeft = UDim.new(0, 2)
- scrollPadding.PaddingRight = UDim.new(0, 8)
- scrollPadding.PaddingTop = UDim.new(0, 2)
- scrollPadding.PaddingBottom = UDim.new(0, 2)
- scrollPadding.Parent = scroll
- scroll.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- scroll.BackgroundTransparency = 0
- scroll.BorderSizePixel = 0
- scroll.CanvasSize = UDim2.new(0, 0, 0, 0)
- scroll.ScrollBarThickness = 6
- scroll.ScrollBarImageColor3 = Color3.fromRGB(255, 255, 255)
- scroll.Parent = listFrame
- local layout = Instance.new("UIListLayout")
- layout.Padding = UDim.new(0, 2)
- layout.SortOrder = Enum.SortOrder.LayoutOrder
- layout.Parent = scroll
- local bottomPanel = Instance.new("Frame")
- bottomPanel.Size = UDim2.new(1, 0, 0, 40)
- bottomPanel.Position = UDim2.new(0, 0, 0, 460)
- bottomPanel.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- bottomPanel.BackgroundTransparency = 0
- bottomPanel.BorderSizePixel = 2
- bottomPanel.BorderColor3 = Color3.fromRGB(255, 255, 255)
- bottomPanel.Parent = frame
- local scanBtn = Instance.new("TextButton")
- scanBtn.Size = UDim2.new(0.28, 0, 0.8, 0)
- scanBtn.Position = UDim2.new(0.02, 0, 0.1, 0)
- scanBtn.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- scanBtn.BackgroundTransparency = 0
- scanBtn.BorderSizePixel = 1
- scanBtn.BorderColor3 = Color3.fromRGB(255, 0, 0)
- scanBtn.Text = "START"
- scanBtn.TextColor3 = Color3.fromRGB(255, 0, 0)
- scanBtn.TextScaled = true
- scanBtn.Font = Enum.Font.GothamBold
- scanBtn.Parent = bottomPanel
- local refreshBtn = Instance.new("TextButton")
- refreshBtn.Size = UDim2.new(0.28, 0, 0.8, 0)
- refreshBtn.Position = UDim2.new(0.36, 0, 0.1, 0)
- refreshBtn.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- refreshBtn.BackgroundTransparency = 0
- refreshBtn.BorderSizePixel = 1
- refreshBtn.BorderColor3 = Color3.fromRGB(255, 255, 255)
- refreshBtn.Text = "REFRESH"
- refreshBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
- refreshBtn.TextScaled = true
- refreshBtn.Font = Enum.Font.Gotham
- refreshBtn.Parent = bottomPanel
- local historyBtn = Instance.new("TextButton")
- historyBtn.Size = UDim2.new(0.28, 0, 0.8, 0)
- historyBtn.Position = UDim2.new(0.70, 0, 0.1, 0)
- historyBtn.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- historyBtn.BackgroundTransparency = 0
- historyBtn.BorderSizePixel = 1
- historyBtn.BorderColor3 = Color3.fromRGB(255, 255, 255)
- historyBtn.Text = "HISTORY"
- historyBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
- historyBtn.TextScaled = true
- historyBtn.Font = Enum.Font.Gotham
- historyBtn.Parent = bottomPanel
- local historyFrame = Instance.new("Frame")
- historyFrame.Size = UDim2.new(1, 0, 0, 385)
- historyFrame.Position = UDim2.new(0, 0, 0, 74)
- historyFrame.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- historyFrame.BackgroundTransparency = 0
- historyFrame.BorderSizePixel = 2
- historyFrame.BorderColor3 = Color3.fromRGB(255, 255, 255)
- historyFrame.Visible = false
- historyFrame.Parent = frame
- local historyScroll = Instance.new("ScrollingFrame")
- historyScroll.Size = UDim2.new(1, 0, 1, 0)
- historyScroll.Position = UDim2.new(0, 0, 0, 0)
- local historyScrollPadding = Instance.new("UIPadding")
- historyScrollPadding.PaddingLeft = UDim.new(0, 2)
- historyScrollPadding.PaddingRight = UDim.new(0, 8)
- historyScrollPadding.PaddingTop = UDim.new(0, 2)
- historyScrollPadding.PaddingBottom = UDim.new(0, 2)
- historyScrollPadding.Parent = historyScroll
- historyScroll.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- historyScroll.BackgroundTransparency = 0
- historyScroll.BorderSizePixel = 0
- historyScroll.CanvasSize = UDim2.new(0, 0, 0, 0)
- historyScroll.ScrollBarThickness = 6
- historyScroll.ScrollBarImageColor3 = Color3.fromRGB(255, 255, 255)
- historyScroll.Parent = historyFrame
- local historyLayout = Instance.new("UIListLayout")
- historyLayout.Padding = UDim.new(0, 2)
- historyLayout.SortOrder = Enum.SortOrder.LayoutOrder
- historyLayout.Parent = historyScroll
- return {
- Frame = frame,
- Status = status,
- Counter = counter,
- Scroll = scroll,
- Layout = layout,
- Button = scanBtn,
- RefreshBtn = refreshBtn,
- HistoryBtn = historyBtn,
- HistoryFrame = historyFrame,
- HistoryScroll = historyScroll,
- HistoryLayout = historyLayout,
- ListFrame = listFrame
- }
- end
- gui = createGUI()
- local function playSound(id)
- if currentSound then
- pcall(function()
- currentSound:Stop()
- currentSound:Destroy()
- end)
- currentSound = nil
- currentPlaying = nil
- end
- if not id then return end
- local success, sound = pcall(function()
- local s = Instance.new("Sound")
- s.SoundId = "rbxassetid://" .. id
- s.Volume = 1
- s.Parent = SoundService
- s:Play()
- return s
- end)
- if success and sound then
- currentSound = sound
- currentPlaying = id
- sound.Stopped:Connect(function()
- if currentSound == sound then
- currentSound = nil
- currentPlaying = nil
- pcall(updateList)
- end
- end)
- pcall(updateList)
- end
- end
- local function updateList()
- if not gui or not gui.Scroll then return end
- local scroll = gui.Scroll
- for _, child in pairs(scroll:GetChildren()) do
- if child:IsA("Frame") then
- child:Destroy()
- end
- end
- local sorted = {}
- for id, data in pairs(foundIds) do
- table.insert(sorted, {id = id, name = data.name or "Unknown"})
- end
- table.sort(sorted, function(a, b)
- local numA = tonumber(a.id)
- local numB = tonumber(b.id)
- if numA == nil and numB == nil then
- return tostring(a.id) < tostring(b.id)
- elseif numA == nil then
- return false
- elseif numB == nil then
- return true
- end
- return numA < numB
- end)
- for _, data in pairs(sorted) do
- local item = Instance.new("Frame")
- item.Size = UDim2.new(1, 0, 0, 30)
- item.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
- item.BackgroundTransparency = 0
- item.BorderSizePixel = 1
- item.BorderColor3 = Color3.fromRGB(255, 255, 255)
- item.Parent = scroll
- local text = Instance.new("TextLabel")
- text.Size = UDim2.new(0.55, 0, 1, 0)
- text.Position = UDim2.new(0, 0, 0, 0)
- text.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
- text.BackgroundTransparency = 0
- text.BorderSizePixel = 0
- local displayName = data.name
- if string.len(displayName) > 25 then
- displayName = string.sub(displayName, 1, 22) .. "..."
- end
- text.Text = string.format("%s | %s", data.id, displayName)
- text.TextColor3 = Color3.fromRGB(255, 255, 255)
- text.TextScaled = true
- text.Font = Enum.Font.Gotham
- text.TextXAlignment = Enum.TextXAlignment.Left
- text.Parent = item
- local play = Instance.new("TextButton")
- play.Size = UDim2.new(0.13, 0, 0.9, 0)
- play.Position = UDim2.new(0.57, 0, 0.05, 0)
- play.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
- play.BackgroundTransparency = 0
- play.BorderSizePixel = 1
- play.BorderColor3 = currentPlaying == data.id and Color3.fromRGB(255, 255, 0) or Color3.fromRGB(0, 255, 0)
- play.Text = currentPlaying == data.id and "STOP" or "PLAY"
- play.TextColor3 = currentPlaying == data.id and Color3.fromRGB(255, 255, 0) or Color3.fromRGB(0, 255, 0)
- play.TextScaled = true
- play.Font = Enum.Font.Gotham
- play.Parent = item
- play.MouseButton1Click:Connect(function()
- if currentPlaying == data.id then
- if currentSound then
- pcall(function()
- currentSound:Stop()
- currentSound:Destroy()
- end)
- currentSound = nil
- currentPlaying = nil
- pcall(updateList)
- end
- else
- playSound(data.id)
- end
- end)
- local copy = Instance.new("TextButton")
- copy.Size = UDim2.new(0.13, 0, 0.9, 0)
- copy.Position = UDim2.new(0.71, 0, 0.05, 0)
- copy.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
- copy.BackgroundTransparency = 0
- copy.BorderSizePixel = 1
- copy.BorderColor3 = Color3.fromRGB(0, 150, 255)
- copy.Text = "COPY"
- copy.TextColor3 = Color3.fromRGB(0, 150, 255)
- copy.TextScaled = true
- copy.Font = Enum.Font.Gotham
- copy.Parent = item
- copy.MouseButton1Click:Connect(function()
- copyToClipboard(data.id)
- end)
- local delete = Instance.new("TextButton")
- delete.Size = UDim2.new(0.12, 0, 0.9, 0)
- delete.Position = UDim2.new(0.85, 0, 0.05, 0)
- delete.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
- delete.BackgroundTransparency = 0
- delete.BorderSizePixel = 1
- delete.BorderColor3 = Color3.fromRGB(255, 0, 0)
- delete.Text = "X"
- delete.TextColor3 = Color3.fromRGB(255, 0, 0)
- delete.TextScaled = true
- delete.Font = Enum.Font.Gotham
- delete.Parent = item
- delete.MouseButton1Click:Connect(function()
- foundIds[data.id] = nil
- pcall(updateList)
- end)
- end
- gui.Counter.Text = "FOUND: " .. #sorted
- scroll.CanvasSize = UDim2.new(0, 0, 0, #sorted * 32 + 5)
- end
- local function updateHistory()
- if not gui or not gui.HistoryScroll then return end
- local historyScroll = gui.HistoryScroll
- for _, child in pairs(historyScroll:GetChildren()) do
- if child:IsA("TextLabel") then
- child:Destroy()
- end
- end
- local sortedHistory = {}
- for id, data in pairs(history) do
- table.insert(sortedHistory, {id = id, name = data.name or "Unknown", time = data.time or 0})
- end
- table.sort(sortedHistory, function(a, b)
- return (a.time or 0) > (b.time or 0)
- end)
- for _, data in pairs(sortedHistory) do
- local label = Instance.new("TextLabel")
- label.Size = UDim2.new(1, 0, 0, 25)
- label.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
- label.BackgroundTransparency = 0
- label.BorderSizePixel = 1
- label.BorderColor3 = Color3.fromRGB(255, 255, 255)
- local displayName = data.name
- if string.len(displayName) > 30 then
- displayName = string.sub(displayName, 1, 27) .. "..."
- end
- label.Text = string.format("%s | %s", data.id, displayName)
- label.TextColor3 = Color3.fromRGB(200, 200, 200)
- label.TextScaled = true
- label.Font = Enum.Font.Gotham
- label.TextXAlignment = Enum.TextXAlignment.Left
- label.Parent = historyScroll
- end
- historyScroll.CanvasSize = UDim2.new(0, 0, 0, #sortedHistory * 27 + 5)
- end
- local function addToHistory(id, name)
- if not history[id] then
- history[id] = {
- id = id,
- name = name or "Unknown",
- time = os.time()
- }
- end
- end
- local function trackSound(sound)
- if not sound or not sound:IsA("Sound") and not sound:IsA("Music") then
- return
- end
- local key = tostring(sound)
- if trackedSounds[key] then
- return
- end
- trackedSounds[key] = true
- local function checkSound()
- local id = getCleanId(sound.SoundId)
- if id and not foundIds[id] then
- foundIds[id] = {
- id = id,
- name = sound.Name or "Unknown"
- }
- addToHistory(id, sound.Name)
- pcall(updateList)
- pcall(updateHistory)
- end
- end
- checkSound()
- pcall(function()
- sound:GetPropertyChangedSignal("SoundId"):Connect(function()
- if not isScanning then return end
- local id = getCleanId(sound.SoundId)
- if id and not foundIds[id] then
- foundIds[id] = {
- id = id,
- name = sound.Name or "Unknown"
- }
- addToHistory(id, sound.Name)
- pcall(updateList)
- pcall(updateHistory)
- end
- end)
- end)
- pcall(function()
- sound:GetPropertyChangedSignal("IsPlaying"):Connect(function()
- if not isScanning then return end
- if sound.IsPlaying then
- local id = getCleanId(sound.SoundId)
- if id and not foundIds[id] then
- foundIds[id] = {
- id = id,
- name = sound.Name or "Unknown"
- }
- addToHistory(id, sound.Name)
- pcall(updateList)
- pcall(updateHistory)
- end
- end
- end)
- end)
- end
- local function startContinuousScan()
- if scanLoop then
- scanLoop:Disconnect()
- scanLoop = nil
- end
- scanLoop = RunService.Heartbeat:Connect(function()
- if not isScanning then return end
- updateCooldown = updateCooldown + 1
- if updateCooldown < 5 then return end
- updateCooldown = 0
- local newSounds = {}
- pcall(function()
- for _, obj in pairs(game:GetDescendants()) do
- if (obj:IsA("Sound") or obj:IsA("Music")) and not trackedSounds[tostring(obj)] then
- table.insert(newSounds, obj)
- end
- end
- end)
- for _, sound in pairs(newSounds) do
- trackSound(sound)
- end
- end)
- end
- local function fastScan()
- local newFound = 0
- pcall(function()
- for _, obj in pairs(game:GetDescendants()) do
- if obj:IsA("Sound") or obj:IsA("Music") then
- local id = getCleanId(obj.SoundId)
- if id and not foundIds[id] then
- foundIds[id] = {
- id = id,
- name = obj.Name or "Unknown"
- }
- addToHistory(id, obj.Name)
- newFound = newFound + 1
- end
- trackSound(obj)
- end
- end
- end)
- if newFound > 0 then
- pcall(updateList)
- pcall(updateHistory)
- end
- end
- local function toggleScanning()
- isScanning = not isScanning
- if isScanning then
- gui.Button.Text = "STOP"
- gui.Button.TextColor3 = Color3.fromRGB(0, 255, 0)
- gui.Button.BorderColor3 = Color3.fromRGB(0, 255, 0)
- gui.Status.Text = "SCANNING"
- gui.Status.TextColor3 = Color3.fromRGB(0, 255, 0)
- gui.Status.BorderColor3 = Color3.fromRGB(0, 255, 0)
- gui.Counter.TextColor3 = Color3.fromRGB(0, 255, 0)
- gui.Counter.BorderColor3 = Color3.fromRGB(0, 255, 0)
- fastScan()
- startContinuousScan()
- else
- gui.Button.Text = "START"
- gui.Button.TextColor3 = Color3.fromRGB(255, 0, 0)
- gui.Button.BorderColor3 = Color3.fromRGB(255, 0, 0)
- gui.Status.Text = "STOPPED"
- gui.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
- gui.Status.BorderColor3 = Color3.fromRGB(255, 0, 0)
- gui.Counter.TextColor3 = Color3.fromRGB(255, 0, 0)
- gui.Counter.BorderColor3 = Color3.fromRGB(255, 0, 0)
- if scanLoop then
- scanLoop:Disconnect()
- scanLoop = nil
- end
- end
- end
- gui.Button.MouseButton1Click:Connect(toggleScanning)
- gui.RefreshBtn.MouseButton1Cl
Advertisement
Add Comment
Please, Sign In to add comment