
KeylessUniversal

-- [[ RE-FIXED MUSIC PLAYER (UPDATED HORM BLUEBERRY) ]]
-- วิธีใช้: นำสคริปต์นี้ไปใส่ใน LocalScript ภายใน StarterGui เท่านั้น
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local ContentProvider = game:GetService("ContentProvider")
local localPlayer = Players.LocalPlayer
-- รอโหลด PlayerGui ป้องกันสคริปต์หลุด
local playerGui = localPlayer:WaitForChild("PlayerGui", 15)
if not playerGui then return end
-- ลบ UI เก่าที่อาจซ้อนกันอยู่ทิ้งก่อน
local oldMusicGui = playerGui:FindFirstChild("PureMusicSystemGui")
if oldMusicGui then oldMusicGui:Destroy() end
-- ==========================================
-- รายชื่อเพลงอัปเดตล่าสุด (เอา Nok Khun Lhee ออก + เพิ่ม หอมบลูเบอร์รี่)
-- ==========================================
local Playlist = {
{Name = "1. ใจบาง", ID = 74367872377052},
{Name = "2. หอมบลูเบอร์รี่ (เพลงใหม่)", ID = 107179735782116}, -- เปลี่ยนเป็นเพลงนี้ให้แล้วครับ
{Name = "3. ชิปปี้ (เพลงใหม่)", ID = 16190783444},
{Name = "4. เสื้อดำ (เพลงใหม่)", ID = 77327932602677},
{Name = "5. katha f16 (แก้ไข ID)", ID = 109317279967858},
{Name = "6. เด็กชายแค้น(เพลงเรื้อน)", ID = 119338842119089},
{Name = "7. ไม่รู้ชื่อ", ID = 91350648636448},
{Name = "8. One of One", ID = 105201227602807},
{Name = "9. ทูยัง", ID = 75883267071992},
{Name = "10. โจรปล้นใจ(เพลงเพราะ)", ID = 137069780570013}
}
-- ==========================================
-- ระบบเสียงเกาะติดตัวละคร + Preload โหลดไฟล์ล่วงหน้า
-- ==========================================
local localSound = Instance.new("Sound")
localSound.Name = "AdminLocalSound"
localSound.Looped = true
local function updateSoundParent()
local char = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart", 5)
if hrp then
localSound.Parent = hrp
else
localSound.Parent = char
end
end
updateSoundParent()
localPlayer.CharacterAdded:Connect(updateSoundParent)
local distortionEffect = Instance.new("DistortionSoundEffect")
distortionEffect.Level = 0.85
distortionEffect.Enabled = false
distortionEffect.Parent = localSound
-- บังคับพรีโหลดไฟล์เสียงทั้งหมดเข้าระบบเพื่อแก้ปัญหาเพลงโหลดไม่ขึ้น
task.spawn(function()
local soundInstances = {}
for _, item in ipairs(Playlist) do
local testSound = Instance.new("Sound")
testSound.SoundId = "rbxassetid://" .. tostring(item.ID)
table.insert(soundInstances, testSound)
end
pcall(function()
ContentProvider:PreloadAsync(soundInstances)
print("✅ อัปเดตรายชื่อเพลงและพรีโหลดเข้าเครื่องสำเร็จ!")
end)
end)
-- ==========================================
-- การสร้าง UI หน้าต่างเพลง (GUI SETUP)
-- ==========================================
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "PureMusicSystemGui"
screenGui.ResetOnSpawn = false
screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
-- ปุ่มลอย เปิด/ปิดหน้าต่างเพลงหลัก
local toggleBtn = Instance.new("TextButton")
toggleBtn.Size = UDim2.new(0, 140, 0, 40)
toggleBtn.Position = UDim2.new(0.02, 0, 0.45, 0)
toggleBtn.BackgroundColor3 = Color3.fromRGB(40, 120, 80)
toggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
toggleBtn.Text = "🎵 เปิด/ปิด เมนูเพลง"
toggleBtn.Font = Enum.Font.SourceSansBold
toggleBtn.TextSize = 14
toggleBtn.ZIndex = 10
toggleBtn.Parent = screenGui
local tCorner = Instance.new("UICorner") tCorner.CornerRadius = UDim.new(0, 8) tCorner.Parent = toggleBtn
-- หน้าต่างระบบเพลง (Music Main Window)
local musicWindow = Instance.new("Frame")
musicWindow.Size = UDim2.new(0, 310, 0, 410)
musicWindow.Position = UDim2.new(0.1, 0, 0.25, 0)
musicWindow.BackgroundColor3 = Color3.fromRGB(35, 35, 50)
musicWindow.BorderSizePixel = 0
musicWindow.Visible = false
musicWindow.Active = true
musicWindow.ZIndex = 5
musicWindow.Parent = screenGui
local musicCorner = Instance.new("UICorner")
musicCorner.CornerRadius = UDim.new(0, 8)
musicCorner.Parent = musicWindow
-- ==========================================
-- ฟังก์ชันช่วยสร้างปุ่มและกรอกข้อความ (UI UTILS)
-- ==========================================
local function createButton(text, pos, size, parent, color)
local btn = Instance.new("TextButton")
btn.Text = text
btn.Position = pos
btn.Size = size
btn.BackgroundColor3 = color or Color3.fromRGB(50, 50, 70)
btn.TextColor3 = Color3.fromRGB(255, 255, 255)
btn.Font = Enum.Font.SourceSansBold
btn.TextSize = 14
btn.Parent = parent
local c = Instance.new("UICorner") c.CornerRadius = UDim.new(0, 6) c.Parent = btn
return btn
end
local function createTextBox(placeholder, pos, size, parent)
local box = Instance.new("TextBox")
box.PlaceholderText = placeholder
box.Position = pos
box.Size = size
box.BackgroundColor3 = Color3.fromRGB(20, 20, 30)
box.TextColor3 = Color3.fromRGB(255, 255, 255)
box.Font = Enum.Font.SourceSans
box.TextSize = 14
box.Parent = parent
local c = Instance.new("UICorner") c.CornerRadius = UDim.new(0, 6) c.Parent = box
return box
end
-- ส่วนประกอบด้านในหน้าต่างเพลง
local mTitle = Instance.new("TextLabel")
mTitle.Size = UDim2.new(1, 0, 0, 35)
mTitle.BackgroundTransparency = 1
mTitle.Text = "🎧 เมนูเครื่องเล่นเพลง (หอมบลูเบอร์รี่)"
mTitle.TextColor3 = Color3.fromRGB(255, 255, 255)
mTitle.TextSize = 14
mTitle.Font = Enum.Font.SourceSansBold
mTitle.Parent = musicWindow
local musicIdBox = createTextBox("ใส่ Sound ID", UDim2.new(0.05, 0, 0.11, 0), UDim2.new(0.9, 0, 0, 30), musicWindow)
local volumeBox = createTextBox("ระดับเสียง (1 - 100)", UDim2.new(0.05, 0, 0.21, 0), UDim2.new(0.9, 0, 0, 30), musicWindow)
volumeBox.Text = "50"
local playMusicBtn = createButton("▶️ เล่นเพลง", UDim2.new(0.05, 0, 0.32, 0), UDim2.new(0.42, 0, 0, 32), musicWindow, Color3.fromRGB(40, 70, 90))
local stopMusicBtn = createButton("⏸️ หยุด", UDim2.new(0.53, 0, 0.32, 0), UDim2.new(0.42, 0, 0, 32), musicWindow)
local distortBtn = createButton("📻 เปิดเอฟเฟกต์เสียงแตก (ปิด)", UDim2.new(0.05, 0, 0.43, 0), UDim2.new(0.9, 0, 0, 30), musicWindow, Color3.fromRGB(60, 60, 60))
-- รายการเพลงเลื่อนเลือกกด (ScrollingFrame)
local scrollList = Instance.new("ScrollingFrame")
scrollList.Size = UDim2.new(0.9, 0, 0.43, 0)
scrollList.Position = UDim2.new(0.05, 0, 0.53, 0)
scrollList.BackgroundTransparency = 1
scrollList.CanvasSize = UDim2.new(0, 0, 0, #Playlist * 32)
scrollList.ScrollBarThickness = 5
scrollList.Parent = musicWindow
-- ==========================================
-- ระบบควบคุมเสียงและการทำงาน (MUSIC LOGIC)
-- ==========================================
local function playSong(id)
if not id then return end
local numVolume = tonumber(volumeBox.Text) or 50
local calculatedVolume = math.clamp(numVolume / 10, 0, 10)
pcall(function()
localSound:Stop()
localSound.SoundId = "rbxassetid://" .. tostring(id)
localSound.Volume = calculatedVolume
localSound.RollOffMaxDistance = 100000
localSound.RollOffMinDistance = 100000
localSound:Play()
end)
end
-- สร้างปุ่มรายชื่อเพลงในรายการทั้งหมด
for index, item in ipairs(Playlist) do
local songBtn = createButton(" " .. item.Name, UDim2.new(0, 0, 0, (index - 1) * 32), UDim2.new(0.96, 0, 0, 26), scrollList, Color3.fromRGB(45, 45, 60))
songBtn.TextXAlignment = Enum.TextXAlignment.Left
songBtn.TextSize = 12
songBtn.MouseButton1Click:Connect(function()
musicIdBox.Text = tostring(item.ID)
playSong(item.ID)
end)
end
-- การทำงานของปุ่มเปิด/ปิดหน้าต่างหลัก
toggleBtn.MouseButton1Click:Connect(function()
musicWindow.Visible = not musicWindow.Visible
end)
playMusicBtn.MouseButton1Click:Connect(function()
local id = tonumber(musicIdBox.Text)
if id then playSong(id) end
end)
stopMusicBtn.MouseButton1Click:Connect(function()
localSound:Stop()
end)
distortBtn.MouseButton1Click:Connect(function()
distortionEffect.Enabled = not distortionEffect.Enabled
if distortionEffect.Enabled then
distortBtn.Text = "📻 เปิดเอฟเฟกต์เสียงแตก (เปิด)"
distortBtn.BackgroundColor3 = Color3.fromRGB(120, 60, 40)
else
distortBtn.Text = "📻 เปิดเอฟเฟกต์เสียงแตก (ปิด)"
distortBtn.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
end
end)
-- ==========================================
-- ระบบลากหน้าต่าง (DRAG SYSTEM)
-- ==========================================
local function setupDrag(frame)
local dragging, dragInput, dragStart, startPos
frame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragging = true
dragStart = input.Position
startPos = frame.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then dragging = false end
end)
end
end)
UserInputService.InputChanged:Connect(function(input)
if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
local delta = input.Position - dragStart
frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
end
end)
end
setupDrag(musicWindow)
-- ส่ง UI ขึ้นหน้าจอ พร้อมใช้งาน
screenGui.Parent = playerGui
print("Music System Core updated: Nok Khun Lhee replaced with Horm Blueberry!")No comments yet for this script.



