local a=nil function this.new()if not a then local a={}setmetatable(a,this)return a end return a end function this.GetEnvironment(a)local z="\082\101\108\101\097\115\101"if(game:GetService("\082\117\110\083\101\114\118\105\099\101")):IsStudio()then z="\068\101\098\117\103"end return z end function this.GetFlags(a)return script.Flags[a:GetEnvironment()]:GetChildren()end function this.GetEnabledFlags(a)local z={}for a,U in pairs(a:GetFlags())do if U.Value==true then z[U.Name]=true end end return z end function this.GetDisabledFlags(a)local z={}for a,U in pairs(a:GetFlags())do if U.Value==false then z[U.Name]=true end end return z end function this.IsFlagEnabled(z,a)local U=z:GetEnabledFlags()if U[a]then return true end return false end return this


local currentTestingService = nil

function this.new()
	if not currentTestingService then
		local self = {}--Service.new() -- change this to "local self = {}" Nvm I did it for you
		setmetatable(self,this)
		
		return self	
	end
	return currentTestingService -- return cached TestingService
end

function this:GetEnvironment()
	local Environment = "Release"
	if game:GetService("RunService"):IsStudio() then
		Environment = "Debug"
	end
	return Environment
end


function this:GetFlags()
	return script.Flags[self:GetEnvironment()]:GetChildren()
end

function this:GetEnabledFlags() -- returns flags that are turned on for the environment
	local EnabledFlags = {}
	for i,v in pairs(self:GetFlags()) do
		if v.Value == true then
			EnabledFlags[v.Name] = true -- For example -> if EnabledFlags["SecretFeature1"] then ...
		end
	end
	return EnabledFlags
end
	
function this:GetDisabledFlags() -- returns flags that are turned off for the environment
	local DisabledFlags = {}
	for i,v in pairs(self:GetFlags()) do
		if v.Value == false then
			DisabledFlags[v.Name] = true -- For example -> if DisabledFlags["SecretFeature1"] then ...
		end
	end
	return DisabledFlags
end
	
function this:IsFlagEnabled(FlagName) -- it's not exactly efficient and direct referencing
	-- would be faster, but we're trying to prevent errors here!
	-- FindFirstChild would be more efficient and scan quicker but it really doesn't make that much of a difference here
	-- I don't expect anybody to be calling this function frame by frame. Just cache the result ¯\_(ツ)_/¯
	local EnabledFlags = self:GetEnabledFlags()
	if EnabledFlags[FlagName] then
		return true
	end
	return false
end

return this
