Kombiniere das =


local Holder = workspace["MusicHolder"]
local Gui = script.Parent
local Components = {}
local CurrentSong, SongStatus = nil, "Playing"
local SoundEndRender, TimeLeft
local TotalTime
local LastTick, LastLeft
local elapsed

for a, b in pairs(Gui.Frame:GetChildren()) do 
	Components[b.Name] = b
end

local MusicTitleTransparency = {}
local function MusicTitleFade()
	MusicTitleTransparency["TitleIn"] = game.TweenService:Create(Components.Title, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {TextTransparency = 0})
	MusicTitleTransparency["TitleOut"] = game.TweenService:Create(Components.Title, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {TextTransparency = 1})
	MusicTitleTransparency["TitleIn"].Completed:Connect(function()
		task.wait(3)
		if MusicTitleTransparency["TitleOut"] then
			MusicTitleTransparency["TitleOut"]:Play()
		end
	end)
	MusicTitleTransparency["TitleIn"]:Play()
end

local function AssignNumbers()
	for i, v in pairs(Holder:GetChildren()) do 
		local Number = Instance.new("IntValue")
		Number.Name = "Number"
		Number.Value = i
		Number.Parent = v
		local Volume = Instance.new("NumberValue")
		Volume.Name = "Volume"
		Volume.Value = v.Volume
		Volume.Parent = v
	end
end AssignNumbers()

local function ReturnRandomSong()
	return Holder:GetChildren()[math.random(1, #Holder:GetChildren())]
end

local function ReturnNext()
	local Current = CurrentSong:FindFirstChild("Number").Value
	local Next = (Current + 1)
	if Next > #Holder:GetChildren() then Next = 1 end
	for _, b in pairs(Holder:GetChildren()) do 
		if b:FindFirstChild("Number").Value == Next then return b end
	end
end

local function ButtonColourTween(Button)
	Button.ImageColor3 = Color3.fromRGB(255, 255, 255)
	game.TweenService:Create(Button, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, true), {ImageColor3 = Color3.fromRGB(34, 255, 122)}):Play()
end

local function Effect()
	if MusicTitleTransparency["TitleIn"] then
		MusicTitleTransparency["TitleIn"]:Cancel()
		MusicTitleTransparency["TitleIn"] = nil
	end
	if MusicTitleTransparency["TitleOut"] then
		MusicTitleTransparency["TitleOut"]:Cancel()
		MusicTitleTransparency["TitleOut"] = nil
	end
	Components.Title.TextTransparency = 1
	delay(1, MusicTitleFade)
end

local function ReturnPrevious()
	local Current = CurrentSong:FindFirstChild("Number").Value
	local Prev = (Current - 1)
	if Prev < 1 then Prev = #Holder:GetChildren() end
	for _, b in pairs(Holder:GetChildren()) do 
		if b:FindFirstChild("Number").Value == Prev then return b end
	end
end

local function StopCurrentSong(Paused, Unknown)
	local CS = Unknown or CurrentSong
	if not CS then return end
	local Tween = game.TweenService:Create(CS, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Volume = 0})
	Tween.Completed:Connect(function()
		if Paused then CS:Pause() else CS:Stop() end
	end)
	Tween:Play()
end

local function PlaySong(Sound)
	if SoundEndRender then SoundEndRender:Disconnect() end
	local function Yield()
		local Elapsed, Loaded = 0, false
		while Elapsed < 8 do 
			Elapsed += 1
			if Sound.TimeLength > 0.1 then Loaded = true break end
			task.wait(1)
		end
		if not Loaded then warn(Sound.Name .. " ID Unable to Load: Music Player Error"); return PlaySong(ReturnNext()) end
	end Yield()

	SoundEndRender = game["Run Service"].RenderStepped:Connect(function()
		if (os.clock() - LastTick) >= 1 and SongStatus == "Playing" then
			for _, o in pairs(Holder:GetChildren()) do 
				if o.Playing and o ~= Sound then StopCurrentSong(false, o) break end
			end
			elapsed += 1
			TimeLeft = (TotalTime - math.floor(Sound.TimePosition + 0.5))
			Components.MusicName.Text = Sound.Name .. " [" .. string.format("%i:%02i", elapsed / 60, elapsed % 60) .. "]"
			if TimeLeft <= 0 or (TimeLeft > LastLeft) then
				SoundEndRender:Disconnect()
				CurrentSong = ReturnNext()
				PlaySong(CurrentSong)
			else
				TimeLeft -= 1
			end
			LastLeft = TimeLeft
			local FillX = ((math.floor(Sound.TimePosition + 0.5)) * 100) / TotalTime
			FillX = (FillX / 100) * 1
			game.TweenService:Create(Components.Progress.Fill, TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Size = UDim2.fromScale(FillX, Components.Progress.Fill.Size.Y.Scale)}):Play()
			LastTick = os.clock()
		end
	end)

	if SongStatus == "Paused" then
		Components.Title.Text = "Currently Resumed"
		Sound:Resume()
	else
		TotalTime = math.floor(Sound.TimeLength + 0.5)
		LastTick, LastLeft = 0, TotalTime
		elapsed = 0
		Components.MusicName.Text = Sound.Name .. " [0:00]"
		Components.Title.Text = "Currently Playing"
		Sound:Play()
	end

	Sound.Volume = 0
	game.TweenService:Create(Sound, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Volume = Sound:FindFirstChild("Volume").Value}):Play()
	Effect()
end

CurrentSong = ReturnRandomSong()
PlaySong(CurrentSong)

local Debounce = false
Components.Control.Pause.Activated:Connect(function()
	if Debounce then return end
	Debounce = true
	ButtonColourTween(Components.Control.Pause.ImageLabel)
	if SongStatus == "Paused" then
		PlaySong(CurrentSong)
		SongStatus = "Playing"
		Components.Control.Pause.ImageLabel.Image = "rbxassetid://13980756617"
	else
		Components.Title.Text = "Currently Paused"
		Effect()
		SongStatus = "Paused"
		StopCurrentSong(true)
		Components.Control.Pause.ImageLabel.Image = "rbxassetid://5048853382"
	end
	task.wait(0.4) Debounce = false
end)

Components.Control.Next.Activated:Connect(function()
	if Debounce then return end
	Debounce = true
	local NextSong = ReturnNext()
	StopCurrentSong(false)
	if SongStatus == "Paused" then
		SongStatus = "Playing"
		Components.Control.Pause.ImageLabel.Image = "rbxassetid://13980756617"
	end
	ButtonColourTween(Components.Control.Next.ImageLabel)
	CurrentSong = NextSong
	PlaySong(CurrentSong)
	task.wait(0.4) Debounce = false
end)

Components.Control.Previous.Activated:Connect(function()
	if Debounce then return end
	Debounce = true
	local PrevSong = ReturnPrevious()
	StopCurrentSong(false)
	if SongStatus == "Paused" then
		SongStatus = "Playing"
		Components.Control.Pause.ImageLabel.Image = "rbxassetid://13980756617"
	end
	ButtonColourTween(Components.Control.Previous.ImageLabel)
	CurrentSong = PrevSong
	PlaySong(CurrentSong)
	task.wait(0.4) Debounce = false
end)


und das =


local songs = {
    "rbxassetid://9043887091",
    "rbxassetid://1845341094",
    "rbxassetid://9044565954",
    "rbxassetid://9046862941",
    "rbxassetid://9046863579",
    "rbxassetid://9046864489",
    "rbxassetid://1839363112",
    "rbxassetid://1840901237",
    "rbxassetid://1847417433",
    "rbxassetid://1847245265",
    "rbxassetid://1840712882",
    "rbxassetid://1847358730",
}