local E=game.Players.LocalPlayer local T local B local u=game.ReplicatedStorage:WaitForChild("\067\105\110\100\101\114\105\110\103\066\071\077")local v=require(u:WaitForChild("\083\101\116\116\105\110\103\115"))local S=u:WaitForChild("\077\117\115\105\099\070\111\108\100\101\114")local Z=S:WaitForChild("\071\108\111\098\097\108\077\117\115\105\099")local R=S:WaitForChild("\077\117\115\105\099\090\111\110\101\115")local K=(u:WaitForChild("\079\098\106\101\099\116\067\111\117\110\116")).Value function GetMatchingCount()local E=0 local function T(B)for B,u in pairs(B:GetChildren())do E=E+1 T(u)end end T(S)if E==K then return true end end while not GetMatchingCount()do wait(.5)end function IsCleanRotation(E)for E,T in pairs(E)do if not(T%90<=.01 or T%90>=89.99)then return false end end return true end


local plr = game.Players.LocalPlayer
local char
local torso

local container = game.ReplicatedStorage:WaitForChild("CinderingBGM")
local settings = require(container:WaitForChild("Settings"))
local musicfolder = container:WaitForChild("MusicFolder")
local globalfolder = musicfolder:WaitForChild("GlobalMusic")
local zonesfolder = musicfolder:WaitForChild("MusicZones")
local servercount = container:WaitForChild("ObjectCount").Value

function GetMatchingCount() --objects can take some time to actually replicate to the client. make sure that the client sees the correct # of objects in the music folder before initializing the rest of the script
	local count = 0
	local function recurse(instance)
		for _,v in pairs(instance:GetChildren()) do
			count = count + 1
			recurse(v)
		end
	end
	recurse(musicfolder)
	if count == servercount then return true end
end

while not GetMatchingCount() do
	wait(.5)
end


function IsCleanRotation(v3values) --check to see whether the rotation is at clean 90 degree increments so we can use the more simplistic calculations for it
	for _,v in pairs(v3values) do
		if not (v%90 <= 0.01 or v%90 >= 89.99) then --why not just check for (v%90 == 0)? because rotations can suffer from floating point inaccuracies
			return false
		end
	end
	return true
end

