local tracks = {
{
id = 1837461008,
name = "N"
},
{
id = 1841905171,
name = "Na"
},
{
id = 1838660362,
name = "Nam"
},
{
id = 1837324424,
name = "e"
},
{
id = 1837848642,
name = "Nae"
},
{
id = 1839029458,
name = "ame"
}
}
local colors = {
Color3.new(1, 1, 1),
Color3.new(0, .64, 1),
Color3.new(1, .8, .2),
Color3.new(1, .3, 1),
Color3.new(0, 1, 0)
}
local runservice = game:GetService(“RunService”)
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local plrgui = plr:WaitForChild(“PlayerGui”)
local scngui = plrgui:WaitForChild(“[MP3]”)
local mframe = scngui:WaitForChild(“mainframe”)
local play = mframe:WaitForChild(“play”)
local stop = mframe:WaitForChild(“stop”)
local nex = mframe:WaitForChild(“next”)
local rep = mframe:WaitForChild(“repeat”)
local prev = mframe:WaitForChild(“prev”)
local label = mframe:WaitForChild(“label”)
local name = mframe:WaitForChild(“name”)
local bar = mframe:WaitForChild(“bar”)
local progress = bar:WaitForChild(“progress”)
local line = bar:WaitForChild(“line”)
local libr = scngui:WaitForChild(“library”)
local add = libr:WaitForChild(“add”)
local shuffle = libr:WaitForChild(“shuffle”)
local color = libr:WaitForChild(“color”)
local newname = libr:WaitForChild(“newname”)
local newid = libr:WaitForChild(“newid”)
local scrframe = libr:WaitForChild(“scrollingframe”)
local sound = script.Parent.Sound
local playing = false
local repeating = false
local shuffling = false
local lmb = false
local theme = 1
local track = 1
function createlibrary()
scrframe:ClearAllChildren()
local c = colors[theme] or Color3.new(1, 1, 1)
local scroll = false
scrframe.CanvasSize = UDim2.new(0, 0, 0, #tracks *30 -2)
if scrframe.AbsoluteSize.Y < #tracks *30 -2 then
scroll = true
end
local count = 0
for i, v in pairs(tracks) do
local name = v[“name”]
local image = v[“image”]
local b = Instance.new(“TextButton”)
b.Name = i
b.Text = “”
b.Size = UDim2.new(1, 0, 0, 28)
if scroll then
b.Size = UDim2.new(1, -12, 0, 28)
end
b.Position = UDim2.new(0, 0, 0, count *30)
b.BorderSizePixel = 0
b.BackgroundTransparency = .5
b.BackgroundColor3 = Color3.new(.122, .122, .122)
local il = Instance.new(“ImageLabel”, b)
il.Size = UDim2.new(1, 0, 1, 0)
il.SizeConstraint = Enum.SizeConstraint.RelativeYY
il.BackgroundTransparency = 1
if image then
il.Image = “rbxassetid://”… image
else
il.Image = “rbxassetid://363053247”
end
il.ImageColor3 = c
local il2 = Instance.new(“ImageButton”, b)
il2.Position = UDim2.new(1, -26, 0, 2)
il2.Size = UDim2.new(0, 24, 0, 24)
il2.SizeConstraint = Enum.SizeConstraint.RelativeYY
il2.BackgroundTransparency = 1
il2.ImageColor3 = c
if track == i then
il2.Image = “rbxassetid://363053392”
else
il2.Image = “”
end
local t
if name then
t = Instance.new(“TextLabel”, b)
t.Text = name
if track == i then
t.Size = UDim2.new(1, -56, 1, 0)
else
t.Size = UDim2.new(1, -28, 1, 0)
end
t.Position = UDim2.new(0, 28, 0, 0)
t.BackgroundTransparency = 1
t.TextXAlignment = Enum.TextXAlignment.Left
t.Font = Enum.Font.SourceSansLight
t.FontSize = Enum.FontSize.Size18
t.TextColor3 = c
t.TextWrapped = true
end
il2.Activated:connect(function()
if i ~= track and #tracks > 1 then
if track >= i then
track = track -1
end
if track < 1 then
track = 1
end
table.remove(tracks, i)
createlibrary()
end
end)
b.Activated:connect(function()
if i ~= track then
sound:Stop()
end
track = i
createlibrary()
resume()
end)
b.MouseEnter:connect(function()
if track ~= i and #tracks > 1 then
il2.Position = UDim2.new(1, -28, 0, 0)
il2.Size = UDim2.new(0, 28, 0, 28)
il2.Image = “rbxassetid://363596208”
if t then
t.Size = UDim2.new(1, -56, 1, 0)
end
end
end)
b.MouseLeave:connect(function()
il2.Position = UDim2.new(1, -26, 0, 2)
il2.Size = UDim2.new(0, 24, 0, 24)
if track == i then
il2.Image = “rbxassetid://363053392”
else
il2.Image = “”
end
if t then
if track == i then
t.Size = UDim2.new(1, -56, 1, 0)
else
t.Size = UDim2.new(1, -28, 1, 0)
end
end
end)
b.Parent = scrframe
count = count +1
end
end
function changecolor()
local c = colors[theme] or Color3.new(1, 1, 1)
newname.TextColor3 = c
newid.TextColor3 = c
shuffle.ImageColor3 = c
rep.ImageColor3 = c
add.ImageColor3 = c
play.ImageColor3 = c
stop.ImageColor3 = c
nex.ImageColor3 = c
prev.ImageColor3 = c
color.ImageColor3 = c
label.ImageColor3 = c
progress.BackgroundColor3 = c
name.TextColor3 = c
createlibrary()
end
function resume()
local s = tracks[track]
if s and s[“id”] and tonumber(string.sub(sound.SoundId, 14)) ~= s.id then
sound.SoundId = “rbxassetid://”… s.id
sound:Play()
end
name.Text = “”
if s[“name”] then
name.Text = s.name
end
sound:Resume()
if s[“image”] then
label.image = “rbxassetid://”… s.image
end
play.Image = “rbxassetid://363053878”
playing = true
end
color.Activated:connect(function()
local changed
for i, v in pairs(colors) do
if color.ImageColor3 == v then
theme = i +1
if theme > #colors then
theme = 1
end
changecolor()
changed = true
break
end
end
if not changed then
changecolor(colors[1])
end
end)
play.Activated:connect(function()
if not playing then
resume()
else
sound:Pause()
play.Image = “rbxassetid://363053392”
playing = false
end
end)
stop.Activated:connect(function()
if playing then
sound:Stop()
play.Image = “rbxassetid://363053392”
playing = false
end
end)
prev.Activated:connect(function()
track = track -1
if track < 1 then
track = #tracks
end
createlibrary()
sound:Stop()
resume()
end)
nex.Activated:connect(function()
track = track +1
if track > #tracks then
track = 1
end
createlibrary()
sound:Stop()
resume()
end)
rep.Activated:connect(function()
repeating = not repeating
sound.Looped = repeating
if repeating then
rep.ImageTransparency = 0
else
rep.ImageTransparency = .75
end
end)
shuffle.Activated:connect(function()
shuffling = not shuffling
if shuffling then
shuffle.Image = “rbxassetid://363552511”
else
shuffle.Image = “rbxassetid://363552398”
end
end)
label.Activated:connect(function()
libr.Visible = not libr.Visible
end)
sound.Ended:connect(function()
if not repeating then
if shuffling and #tracks > 1 then
local current = track
repeat
track = math.random(#tracks)
until track ~= current
else
track = track +1
if track > #tracks then
track = 1
end
end
createlibrary()
sound:Stop()
resume()
end
end)
add.Activated:connect(function()
local d = tonumber(newid.Text)
if d then
table.insert(tracks, {id = d, name = newname.Text})
end
newid.Text = “id”
newname.Text = “name”
createlibrary()
end)
mouse.Button1Down:connect(function()
lmb = true
end)
mouse.Button1Up:connect(function()
lmb = false
end)
createlibrary()
runservice:BindToRenderStep(“mp3player”, 100, function()
progress.Size = UDim2.new(sound.TimePosition /sound.TimeLength, 0, 1, 0)
if mouse.X > bar.AbsolutePosition.X and mouse.X < bar.AbsolutePosition.X +bar.AbsoluteSize.X and
mouse.Y > bar.AbsolutePosition.Y -bar.BorderSizePixel and mouse.Y < bar.AbsolutePosition.Y +bar.AbsoluteSize.Y +bar.BorderSizePixel then
line.Size = UDim2.new(0, mouse.X -bar.AbsolutePosition.X, 1, 0)
if lmb then
local continue = sound.IsPlaying
sound:Pause()
sound.TimePosition = sound.TimeLength *(mouse.X -bar.AbsolutePosition.X) /bar.AbsoluteSize.X
if continue then
repeat
wait()
until not lmb
sound:Resume()
end
end
else
line.Size = UDim2.new()
end
end)