local Players = game:GetService("Players") local HttpService = game:GetService("HttpService") local UIS = game:GetService("UserInputService") local Player = Players.LocalPlayer or Players.PlayerAdded:Wait() local parent = Player:FindFirstChildOfClass("PlayerGui") or game:GetService("CoreGui") pcall(function() local old = parent:FindFirstChild("NeonAudioPlayer") if old then old:Destroy() end end) local gui = Instance.new("ScreenGui") gui.Name = "NeonAudioPlayer" gui.ResetOnSpawn = false gui.DisplayOrder = 999999 pcall(function() gui.Parent = parent end) if not gui.Parent then gui.Parent = Player:WaitForChild("PlayerGui") end local sound = Instance.new("Sound") sound.Volume = 1 sound.Parent = gui local SAVE_FILE = "NeonAudioPlayer_SavedAudios.json" local lang = "pt" local txt = { pt = {t="ÁUDIO PLAYER", cfg="Configuração(⚙️)↓", back="Voltando pra gui↓", id="ID do áudio", nm="Nome do áudio", play="▶ Tocar", pause="⏸ Pausar", save="💾 Salvar", list="Áudios Salvos", listen="▶ Ouvir", del="🗑 Apagar", lg="Língua:", empty="Sem áudios salvos.", bad="ID inválido!", ok="Salvo!", rem="Apagado!", noFile="Sem persistência de arquivo."}, en = {t="AUDIO PLAYER", cfg="Settings(⚙️)↓", back="Back to GUI↓", id="Audio ID", nm="Audio name", play="▶ Play", pause="⏸ Pause", save="💾 Save", list="Saved Audios", listen="▶ Listen", del="🗑 Delete", lg="Language:", empty="No saved audios.", bad="Invalid ID!", ok="Saved!", rem="Deleted!", noFile="No file persistence."}, es = {t="AUDIO PLAYER", cfg="Configuración(⚙️)↓", back="Volviendo a la GUI↓", id="ID de audio", nm="Nombre de audio", play="▶ Reproducir", pause="⏸ Pausar", save="💾 Guardar", list="Audios Guardados", listen="▶ Escuchar", del="🗑 Borrar", lg="Idioma:", empty="Sin audios guardados.", bad="¡ID inválido!", ok="¡Guardado!", rem="¡Borrado!", noFile="Sin persistencia de archivo."} } local bg, sec, neon, ink, dark = Color3.fromRGB(22,20,3), Color3.fromRGB(40,36,5), Color3.fromRGB(255,255,0), Color3.fromRGB(255,255,110), Color3.fromRGB(15,15,0) local saved = {} local function canUseFiles() return type(writefile) == "function" and type(readfile) == "function" end local function loadSavedFromDisk() if not canUseFiles() then return end local exists = true if type(isfile) == "function" then local okEx, resEx = pcall(isfile, SAVE_FILE) exists = okEx and resEx end if not exists then return end local okRead, raw = pcall(readfile, SAVE_FILE) if not okRead or type(raw) ~= "string" or raw == "" then return end local okDecode, decoded = pcall(function() return HttpService:JSONDecode(raw) end) if okDecode and type(decoded) == "table" then local valid = {} for _, item in ipairs(decoded) do if type(item) == "table" and item.id and item.name then local digits = string.match(tostring(item.id), "%d+") if digits then table.insert(valid, { name = tostring(item.name), id = digits }) end end end saved = valid end end local function persistSavedToDisk() if not canUseFiles() then return false end local okEncode, encoded = pcall(function() return HttpService:JSONEncode(saved) end) if not okEncode or type(encoded) ~= "string" then return false end local okWrite = pcall(writefile, SAVE_FILE, encoded) return okWrite == true end loadSavedFromDisk() local function corner(o, r) local c = Instance.new("UICorner"); c.CornerRadius = UDim.new(0, r or 8); c.Parent = o end local function stroke(o) local s = Instance.new("UIStroke"); s.Color = neon; s.Thickness = 1; s.ApplyStrokeMode = Enum.ApplyStrokeMode.Border; s.Parent = o end local function btn(p, sz, pos, t, c1, c2) local b = Instance.new("TextButton"); b.Size = sz; b.Position = pos; b.Text = t; b.BackgroundColor3 = c1 or neon; b.TextColor3 = c2 or dark b.Font = Enum.Font.GothamBold; b.TextSize = 12; b.BorderSizePixel = 0; b.Parent = p; corner(b, 7); return b end local function box(p, sz, pos, ph) local tb = Instance.new("TextBox"); tb.Size = sz; tb.Position = pos; tb.PlaceholderText = ph; tb.Text = ""; tb.ClearTextOnFocus = false tb.BackgroundColor3 = sec; tb.TextColor3 = ink; tb.PlaceholderColor3 = Color3.fromRGB(185,185,70); tb.Font = Enum.Font.Gotham; tb.TextSize = 12 tb.BorderSizePixel = 0; tb.Parent = p; corner(tb, 7); stroke(tb); return tb end local main = Instance.new("Frame") main.Size = UDim2.new(0, 320, 0, 410) main.Position = UDim2.new(0.5, -160, 0.5, -205) main.BackgroundColor3 = bg; main.BorderSizePixel = 0; main.Active = true; main.Parent = gui corner(main, 12); stroke(main) do local drag, startInput, startPos main.InputBegan:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then drag, startInput, startPos = true, i.Position, main.Position i.Changed:Connect(function() if i.UserInputState == Enum.UserInputState.End then drag = false end end) end end) UIS.InputChanged:Connect(function(i) if drag and (i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch) then local d = i.Position - startInput main.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + d.X, startPos.Y.Scale, startPos.Y.Offset + d.Y) end end) end local titleLbl = Instance.new("TextLabel") titleLbl.Size = UDim2.new(1, -54, 0, 34); titleLbl.Position = UDim2.new(0, 10, 0, 4) titleLbl.BackgroundTransparency = 1; titleLbl.Font = Enum.Font.GothamBold; titleLbl.TextSize = 14 titleLbl.TextColor3 = neon; titleLbl.TextXAlignment = Enum.TextXAlignment.Left; titleLbl.Parent = main local toggleWinBtn = btn(main, UDim2.new(0, 32, 0, 28), UDim2.new(1, -42, 0, 7), "-") local cfgBtn = btn(main, UDim2.new(1, -20, 0, 30), UDim2.new(0, 10, 0, 40), "") local cfgPanel = Instance.new("Frame") cfgPanel.Size = UDim2.new(1, -20, 0, 120); cfgPanel.Position = UDim2.new(0, 10, 0, 76) cfgPanel.BackgroundColor3 = sec; cfgPanel.Visible = false; cfgPanel.BorderSizePixel = 0; cfgPanel.Parent = main corner(cfgPanel, 8); stroke(cfgPanel) local langLbl = Instance.new("TextLabel") langLbl.Size = UDim2.new(1, -16, 0, 22); langLbl.Position = UDim2.new(0, 8, 0, 6) langLbl.BackgroundTransparency = 1; langLbl.Font = Enum.Font.GothamBold; langLbl.TextSize = 12 langLbl.TextColor3 = ink; langLbl.TextXAlignment = Enum.TextXAlignment.Left; langLbl.Parent = cfgPanel local bEN = btn(cfgPanel, UDim2.new(0, 86, 0, 30), UDim2.new(0, 8, 0, 32), "🇺🇸 EN", bg, neon) local bES = btn(cfgPanel, UDim2.new(0, 86, 0, 30), UDim2.new(0, 100, 0, 32), "🇪🇦 ES", bg, neon) local bPT = btn(cfgPanel, UDim2.new(0, 86, 0, 30), UDim2.new(0, 192, 0, 32), "🇧🇷 PT", bg, neon) for _, b in ipairs({bEN, bES, bPT}) do stroke(b) end local backBtn = btn(cfgPanel, UDim2.new(1, -16, 0, 30), UDim2.new(0, 8, 0, 80), "") local body = Instance.new("Frame") body.Size = UDim2.new(1, -20, 1, -80); body.Position = UDim2.new(0, 10, 0, 76) body.BackgroundTransparency = 1; body.Parent = main local idBox = box(body, UDim2.new(1, 0, 0, 30), UDim2.new(0, 0, 0, 0), "") local nameBox = box(body, UDim2.new(1, 0, 0, 30), UDim2.new(0, 0, 0, 36), "") local playBtn = btn(body, UDim2.new(0.48, 0, 0, 30), UDim2.new(0, 0, 0, 72), "") local saveBtn = btn(body, UDim2.new(0.48, 0, 0, 30), UDim2.new(0.52, 0, 0, 72), "", sec, neon) stroke(saveBtn) local timeBox = Instance.new("Frame") timeBox.Size = UDim2.new(1, 0, 0, 52); timeBox.Position = UDim2.new(0, 0, 0, 108) timeBox.BackgroundColor3 = sec; timeBox.BorderSizePixel = 0; timeBox.Parent = body corner(timeBox, 8); stroke(timeBox) local rewBtn = btn(timeBox, UDim2.new(0, 46, 0, 22), UDim2.new(0, 6, 0, 5), "⏪ -10s", bg, neon); stroke(rewBtn) local fwdBtn = btn(timeBox, UDim2.new(0, 46, 0, 22), UDim2.new(1, -52, 0, 5), "+10s ⏩", bg, neon); stroke(fwdBtn) local timeLbl = Instance.new("TextLabel") timeLbl.Size = UDim2.new(1, -112, 0, 22); timeLbl.Position = UDim2.new(0, 56, 0, 5) timeLbl.BackgroundTransparency = 1; timeLbl.Font = Enum.Font.GothamBold; timeLbl.TextSize = 11 timeLbl.TextColor3 = ink; timeLbl.Text = "00:00 / 00:00"; timeLbl.Parent = timeBox local barBg = Instance.new("TextButton") barBg.Size = UDim2.new(1, -12, 0, 10); barBg.Position = UDim2.new(0, 6, 1, -15) barBg.BackgroundColor3 = bg; barBg.Text = ""; barBg.AutoButtonColor = false; barBg.BorderSizePixel = 0; barBg.Parent = timeBox corner(barBg, 5) local barFill = Instance.new("Frame") barFill.Size = UDim2.new(0, 0, 1, 0); barFill.BackgroundColor3 = neon; barFill.BorderSizePixel = 0; barFill.Parent = barBg corner(barFill, 5) local listLbl = Instance.new("TextLabel") listLbl.Size = UDim2.new(1, 0, 0, 18); listLbl.Position = UDim2.new(0, 0, 0, 166) listLbl.BackgroundTransparency = 1; listLbl.Font = Enum.Font.GothamBold; listLbl.TextSize = 12 listLbl.TextColor3 = neon; listLbl.TextXAlignment = Enum.TextXAlignment.Left; listLbl.Parent = body local statusLbl = Instance.new("TextLabel") statusLbl.Size = UDim2.new(1, 0, 0, 16); statusLbl.Position = UDim2.new(0, 0, 0, 184) statusLbl.BackgroundTransparency = 1; statusLbl.Font = Enum.Font.Gotham; statusLbl.TextSize = 11 statusLbl.TextColor3 = ink; statusLbl.TextXAlignment = Enum.TextXAlignment.Left; statusLbl.Text = ""; statusLbl.Parent = body local scroll = Instance.new("ScrollingFrame") scroll.Size = UDim2.new(1, 0, 1, -202); scroll.Position = UDim2.new(0, 0, 0, 202) scroll.BackgroundColor3 = sec; scroll.ScrollBarImageColor3 = neon; scroll.ScrollBarThickness = 4 scroll.BorderSizePixel = 0; scroll.CanvasSize = UDim2.new(0, 0, 0, 0); scroll.Parent = body corner(scroll, 8); stroke(scroll) local layout = Instance.new("UIListLayout"); layout.Padding = UDim.new(0, 5); layout.Parent = scroll local pad = Instance.new("UIPadding"); pad.PaddingTop = UDim.new(0,5); pad.PaddingLeft = UDim.new(0,5); pad.PaddingRight = UDim.new(0,5); pad.Parent = scroll local function fmt(s) if not s or s ~= s or s <= 0 then return "00:00" end s = math.floor(s) return string.format("%02d:%02d", math.floor(s/60), s%60) end local function normId(v) local d = string.match(tostring(v or ""), "%d+") return d and ("rbxassetid://" .. d) or nil end -- Troca limpa do Sound ao mudar de ID para nunca reaproveitar buffer/estado anterior local function resetAndPlayAsset(assetId) sound:Stop() sound.TimePosition = 0 sound.SoundId = "" task.wait() sound.SoundId = assetId sound.TimePosition = 0 sound:Play() end local renderList local function refresh() local d = txt[lang] titleLbl.Text = d.t; cfgBtn.Text = cfgPanel.Visible and d.back or d.cfg; backBtn.Text = d.back idBox.PlaceholderText = d.id; nameBox.PlaceholderText = d.nm playBtn.Text = sound.IsPlaying and d.pause or d.play; saveBtn.Text = d.save listLbl.Text = d.list; langLbl.Text = d.lg if renderList then renderList() end end local function playId(v) local id = normId(v) if not id then statusLbl.Text = txt[lang].bad; return end statusLbl.Text = id resetAndPlayAsset(id) end -- Quando o usuário digita outro ID na caixa e clica em Tocar, força o novo ID se for diferente do atual idBox.FocusLost:Connect(function() local id = normId(idBox.Text) if id and sound.SoundId ~= id then sound:Stop() sound.TimePosition = 0 sound.SoundId = id end end) renderList = function() for _, c in ipairs(scroll:GetChildren()) do if c:IsA("Frame") or c:IsA("TextLabel") then c:Destroy() end end local d = txt[lang] if #saved == 0 then local e = Instance.new("TextLabel"); e.Size = UDim2.new(1,0,0,24); e.BackgroundTransparency = 1 e.Font = Enum.Font.Gotham; e.TextSize = 11; e.TextColor3 = ink; e.Text = d.empty; e.Parent = scroll scroll.CanvasSize = UDim2.new(0,0,0,28); return end for i, it in ipairs(saved) do local row = Instance.new("Frame"); row.Size = UDim2.new(1,-4,0,30); row.BackgroundColor3 = bg; row.BorderSizePixel = 0; row.Parent = scroll corner(row, 6); stroke(row) local nl = Instance.new("TextLabel"); nl.Size = UDim2.new(0.46,0,1,0); nl.Position = UDim2.new(0,6,0,0) nl.BackgroundTransparency = 1; nl.Font = Enum.Font.GothamBold; nl.TextSize = 11; nl.TextTruncate = Enum.TextTruncate.AtEnd nl.TextXAlignment = Enum.TextXAlignment.Left; nl.TextColor3 = ink; nl.Text = it.name; nl.Parent = row local lb = btn(row, UDim2.new(0.24,0,0,22), UDim2.new(0.48,0,0.5,-11), d.listen) local db = btn(row, UDim2.new(0.24,0,0,22), UDim2.new(0.74,0,0.5,-11), d.del, Color3.fromRGB(200,40,40), Color3.new(1,1,1)) lb.MouseButton1Click:Connect(function() idBox.Text = it.id; nameBox.Text = it.name; playId(it.id); refresh() end) db.MouseButton1Click:Connect(function() table.remove(saved, i) persistSavedToDisk() statusLbl.Text = txt[lang].rem renderList() end) end task.defer(function() scroll.CanvasSize = UDim2.new(0,0,0,layout.AbsoluteContentSize.Y + 12) end) end local closed = false toggleWinBtn.MouseButton1Click:Connect(function() closed = not closed cfgBtn.Visible = not closed body.Visible = not closed and not cfgPanel.Visible cfgPanel.Visible = not closed and cfgPanel.Visible main.Size = closed and UDim2.new(0, 320, 0, 42) or UDim2.new(0, 320, 0, 410) toggleWinBtn.Text = closed and "+" or "-" if not closed then refresh() end end) local function toggleCfg(v) if closed then return end; cfgPanel.Visible = v; body.Visible = not v; refresh() end cfgBtn.MouseButton1Click:Connect(function() toggleCfg(not cfgPanel.Visible) end) backBtn.MouseButton1Click:Connect(function() toggleCfg(false) end) bEN.MouseButton1Click:Connect(function() lang = "en"; refresh() end) bES.MouseButton1Click:Connect(function() lang = "es"; refresh() end) bPT.MouseButton1Click:Connect(function() lang = "pt"; refresh() end) playBtn.MouseButton1Click:Connect(function() local typedId = normId(idBox.Text) if typedId and sound.SoundId ~= typedId then playId(typedId) refresh() return end if sound.IsPlaying then sound:Pause() else if sound.SoundId == "" or sound.SoundId == "rbxassetid://" then playId(idBox.Text) else sound:Play() end end refresh() end) rewBtn.MouseButton1Click:Connect(function() sound.TimePosition = math.max(0, sound.TimePosition - 10) end) fwdBtn.MouseButton1Click:Connect(function() local m = sound.TimeLength > 0 and sound.TimeLength or (sound.TimePosition + 10) sound.TimePosition = math.min(m, sound.TimePosition + 10) end) local scrub = false local function seek(x) if sound.TimeLength <= 0 or barBg.AbsoluteSize.X <= 0 then return end sound.TimePosition = math.clamp((x - barBg.AbsolutePosition.X) / barBg.AbsoluteSize.X, 0, 1) * sound.TimeLength end barBg.InputBegan:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then scrub = true; seek(i.Position.X) end end) UIS.InputChanged:Connect(function(i) if scrub and (i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch) then seek(i.Position.X) end end) UIS.InputEnded:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then scrub = false end end) saveBtn.MouseButton1Click:Connect(function() local id = normId(idBox.Text) if not id then statusLbl.Text = txt[lang].bad; return end local nm = string.match(nameBox.Text or "", "^%s*(.-)%s*$") if nm == "" then nm = "Audio #" .. tostring(#saved + 1) end table.insert(saved, 1, {name = nm, id = string.match(id, "%d+")}) local wrote = persistSavedToDisk() nameBox.Text = "" statusLbl.Text = wrote and txt[lang].ok or (txt[lang].ok .. " (" .. txt[lang].noFile .. ")") renderList() end) task.spawn(function() while gui.Parent do local c, l = sound.TimePosition, sound.TimeLength timeLbl.Text = fmt(c) .. " / " .. fmt(l) barFill.Size = UDim2.new(l > 0 and math.clamp(c / l, 0, 1) or 0, 0, 1, 0) playBtn.Text = sound.IsPlaying and txt[lang].pause or txt[lang].play task.wait(0.1) end end) refresh()