local C=game:GetService("\080\108\097\121\101\114\115")local l=game:GetService("\068\097\116\097\083\116\111\114\101\083\101\114\118\105\099\101")local x=require(script.table)local p=false local j=300 local v=(game:GetService("\083\101\114\118\101\114\083\116\111\114\097\103\101")):FindFirstChild("\083\097\118\101\073\110\083\116\117\100\105\111")local b=v and v.Value local I=false local t={}function t.typeValid(C)return type(C)~="\117\115\101\114\100\097\116\097",typeof(C)end function t.scanValidity(C,l,x)if type(C)~="\116\097\098\108\101"then return t.scanValidity({input=C},{},{})end l,x=l or{},x or{"\105\110\112\117\116"}l[C]=true local p do local l,x=next(C)if type(l)=="\110\117\109\098\101\114"then p="\065\114\114\097\121"else p="\068\105\099\116\105\111\110\097\114\121"end end local j=0 for C,v in next,C do x[#x+1]=tostring(C)if type(C)=="\110\117\109\098\101\114"then if p=="\068\105\099\116\105\111\110\097\114\121"then return false,x,"\077\105\120\101\100 \065\114\114\097\121\047\068\105\099\116\105\111\110\097\114\121"elseif C%1~=0 then return false,x,"\078\111\110-\105\110\116\101\103\101\114 \105\110\100\101\120"elseif C==math.huge or C==-math.huge then return false,x,"\040-\041\073\110\102\105\110\105\116\121 \105\110\100\101\120"end elseif type(C)~="\115\116\114\105\110\103"then return false,x,"\078\111\110-\115\116\114\105\110\103 \107\101\121",typeof(C)elseif p=="\065\114\114\097\121"then return false,x,"\077\105\120\101\100 \065\114\114\097\121\047\068\105\099\116\105\111\110\097\114\121"end if p=="\065\114\114\097\121"then if j~=C-1 then return false,x,"\065\114\114\097\121 \119\105\116\104 \110\111\110-\115\101\113\117\101\110\116\105\097\108 \105\110\100\101\120\101\115"end j=C end local b,I=t.typeValid(v)if not b then return false,x,"\073\110\118\097\108\105\100 \116\121\112\101",I end if type(v)=="\116\097\098\108\101"then if l[v]then return false,x,"\067\121\099\108\105\099"end local C,p,j,b=t.scanValidity(v,l,x)if not C then return C,p,j,b end end x[#x]=nil end l[C]=nil return true end function t.getStringPath(C)return x.concat(C,"\046")end function t.warnIfInvalid(C)local l,x,p,j=t.scanValidity(C)if not l then if j then warn("\073\110\118\097\108\105\100 \097\116 "..(t.getStringPath(x)..(" \098\101\099\097\117\115\101\058 "..(p..(" \040"..(tostring(j).."\041"))))))else warn("\073\110\118\097\108\105\100 \097\116 "..(t.getStringPath(x)..(" \098\101\099\097\117\115\101\058 "..p)))end end return l end local function U(C)if typeof(C)=="\116\097\098\108\101"then return x.deep(C)else return C end end

local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local table = require(script.table) --If you're using this from GitHub, this is the table in the boilerplate folder.
local RegularSave = false
local RegularSaveNum = 300
local SaveInStudioObject = game:GetService("ServerStorage"):FindFirstChild("SaveInStudio")
local SaveInStudio = SaveInStudioObject and SaveInStudioObject.Value
local Debug = false

local Verifier = {}

function Verifier.typeValid(data)
	return type(data) ~= "userdata", typeof(data)
end

function Verifier.scanValidity(tbl, passed, path)
	if type(tbl) ~= "table" then
		return Verifier.scanValidity({input = tbl}, {}, {})
	end
	passed, path = passed or {}, path or {"input"}
	passed[tbl] = true
	local tblType
	do
		local key, value = next(tbl)
		if type(key) == "number" then
			tblType = "Array"
		else
			tblType = "Dictionary"
		end
	end
	local last = 0
	for key, value in next, tbl do
		path[#path + 1] = tostring(key)
		if type(key) == "number" then
			if tblType == "Dictionary" then
				return false, path, "Mixed Array/Dictionary"
			elseif key%1 ~= 0 then  -- if not an integer
				return false, path, "Non-integer index"
			elseif key == math.huge or key == -math.huge then
				return false, path, "(-)Infinity index"
			end
		elseif type(key) ~= "string" then
			return false, path, "Non-string key", typeof(key)
		elseif tblType == "Array" then
			return false, path, "Mixed Array/Dictionary"
		end
		if tblType == "Array" then
			if last ~= key - 1 then
				return false, path, "Array with non-sequential indexes"
			end
			last = key
		end
		local isTypeValid, valueType = Verifier.typeValid(value)
		if not isTypeValid then
			return false, path, "Invalid type", valueType
		end
		if type(value) == "table" then
			if passed[value] then
				return false, path, "Cyclic"
			end
			local isValid, keyPath, reason, extra = Verifier.scanValidity(value, passed, path)
			if not isValid then
				return isValid, keyPath, reason, extra
			end
		end
		path[#path] = nil
	end
	passed[tbl] = nil
	return true
end

function Verifier.getStringPath(path)
	return table.concat(path, ".")
end

function Verifier.warnIfInvalid(input)
	local isValid, keyPath, reason, extra = Verifier.scanValidity(input)
	if not isValid then
		if extra then
			warn("Invalid at "..Verifier.getStringPath(keyPath).." because: "..reason.." ("..tostring(extra)..")")
		else
			warn("Invalid at "..Verifier.getStringPath(keyPath).." because: "..reason)
		end
	end

	return isValid
end

local function clone(value)
	if typeof(value) == "table" then
		return table.deep(value)
	else
		return value
	end
end
