local N=require(game.ReplicatedStorage:WaitForChild("\082\101\115\111\117\114\099\101\115"))while not N.Loaded do(game:GetService("\082\117\110\083\101\114\118\105\099\101")).Heartbeat:Wait()end local U={}local F={}local J=Random.new()local O=nil function Shuffle()local M=N.Functions.CloneTable(U)for N,U in ipairs(F)do if N then else break end for N,F in ipairs(M)do if N then else break end if F==U then table.remove(M,N)break end end end local z=M[J:NextInteger(1,#M)]if not z then return end O=N.Sound.PlayMusic(z,.5,4,nil,false)if 4<=#F then table.remove(F,1)end table.insert(F,z)end function Clear()N.Sound.StopMusic(1)O=nil F={}end local M=nil function Set(F)local J=N.Directory.Worlds[F]U=J.music Clear()if M then(N.Functions.Tween(M,{2},{Volume=0})).Completed:Connect(function()M:Stop()M:Destroy()end)end local O=J.ambience if O then if O~=0 then M=N.Sound.Play(O,script,1,.3,nil,nil,true)end end end;(N.Signal.Fired("\087\111\114\108\100 \067\104\097\110\103\101\100")):Connect(function(N)Set(N)end)task.defer(function()while true do if N.Settings.MusicEnabled and#U>0 then if not O or O.TimeLength-.5<=O.TimePosition and O.IsLoaded then Shuffle()end elseif not N.Settings.MusicEnabled and O then Clear()end N.Heartbeat(5)end end)
-- Decompiled with the Synapse X Luau decompiler.

local v1 = require(game.ReplicatedStorage:WaitForChild("Resources"))
while not v1.Loaded do
	game:GetService("RunService").Heartbeat:Wait()
end
local u1 = {}
local u2 = {}
local u3 = Random.new()
local u4 = nil
function Shuffle()
	local v2 = v1.Functions.CloneTable(u1)

	for v3, v4 in ipairs(u2) do
		if v3 then
		else
			break
		end

		for v6, v7 in ipairs(v2) do
			if v6 then
			else
				break
			end
			if v7 == v4 then
				table.remove(v2, v6)
				break
			end
		end
	end
	local v9 = v2[u3:NextInteger(1, #v2)]
	if not v9 then
		return
	end
	u4 = v1.Sound.PlayMusic(v9, 0.5, 4, nil, false)
	if 4 <= #u2 then
		table.remove(u2, 1)
	end
	table.insert(u2, v9)
end
function Clear()
	v1.Sound.StopMusic(1)
	u4 = nil
	u2 = {}
end
local u5 = nil
function Set(p1)
	local v10 = v1.Directory.Worlds[p1]
	u1 = v10.music
	Clear()
	if u5 then
		v1.Functions
			.Tween(u5, { 2 }, {
				Volume = 0,
			}).Completed
			:Connect(function()
				u5:Stop()
				u5:Destroy()
			end)
	end
	local l__ambience__11 = v10.ambience
	if l__ambience__11 then
		if l__ambience__11 ~= 0 then
			u5 = v1.Sound.Play(l__ambience__11, script, 1, 0.3, nil, nil, true)
		end
	end
end
v1.Signal.Fired("World Changed"):Connect(function(p2)
	Set(p2)
end)
task.defer(function()
	while true do
		if v1.Settings.MusicEnabled and #u1 > 0 then
			if not u4 or u4.TimeLength - 0.5 <= u4.TimePosition and u4.IsLoaded then
				Shuffle()
			end
		elseif not v1.Settings.MusicEnabled and u4 then
			Clear()
		end
		v1.Heartbeat(5)
	end
end)
