local B={{Name="\080\111\105\110\116\115";Type="\073\110\116\086\097\108\117\101",DefaultValue="\048"}}local function H(H)for B,t in pairs(B)do local E=Instance.new(t.Type)E.Name=t.Name E.Value=t.DefaultValue E.Parent=H end end function LeaderboardManager.new(B)local t=Instance.new("\070\111\108\100\101\114")t.Name="\067\117\115\116\111\109\076\101\097\100\101\114\115\116\097\116\115"t.Parent=B H(t)end function LeaderboardManager.getStat(t,B,H)local E=B:FindFirstChild("\067\117\115\116\111\109\076\101\097\100\101\114\115\116\097\116\115")if not E then return false end if E then return E:FindFirstChild(H)end end function LeaderboardManager.setStat(E,B,H,t)local g=LeaderboardManager:getStat(B,H)if g then g.Value=t end end function LeaderboardManager.incrementStat(E,B,H,t)if not t then t=1 end local g=LeaderboardManager:getStat(B,H)if g then g.Value=g.Value+t end end function LeaderboardManager.decrementStat(E,B,H,t)if not t then t=1 end local g=LeaderboardManager:getStat(B,H)if g then g.Value=g.Value-t end end function LeaderboardManager.resetStat(E,H,t)local g=LeaderboardManager:getStat(H,t)if g then for B,H in pairs(B)do if g==H.Name then g.Value=H.DefaultValue return end end g.Value=0 end end function LeaderboardManager.resetStats(H,B)local t=B:FindFirstChild("\067\117\115\116\111\109\076\101\097\100\101\114\115\116\097\116\115")if not t then return"\078\111 \108\101\097\100\101\114\115\116\097\116\115 \102\111\117\110\100"end local E=t:GetChildren()for H,t in pairs(E)do LeaderboardManager:resetStat(B,E)end end return LeaderboardManager

local stats = {
	{
		Name = "Points",
		Type = "IntValue",
		DefaultValue = "0",
	},
}

local function new(leaderstats)
	for i, stat in pairs(stats) do
		local leaderstat = Instance.new(stat.Type)
		leaderstat.Name = stat.Name
		leaderstat.Value = stat.DefaultValue
		leaderstat.Parent = leaderstats
	end
end

function LeaderboardManager.new(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "CustomLeaderstats"
	leaderstats.Parent = player
	
	new(leaderstats)
end

function LeaderboardManager:getStat(player, stat)
	local leaderstats = player:FindFirstChild("CustomLeaderstats")
	if not leaderstats then return false end
	
	if leaderstats then
		return leaderstats:FindFirstChild(stat)
	end
end

function LeaderboardManager:setStat(player, stat, value)
	local stat = LeaderboardManager:getStat(player, stat)
	
	if stat then
		stat.Value = value 
	end
end

function LeaderboardManager:incrementStat(player, stat, value)
	if (not value) then value = 1 end
	
	local stat = LeaderboardManager:getStat(player, stat)
	
	if stat then
		stat.Value = stat.Value + value
	end
end

function LeaderboardManager:decrementStat(player, stat, value)
	if (not value) then value = 1 end
	
	local stat = LeaderboardManager:getStat(player, stat)
	
	if stat then
		stat.Value = stat.Value - value
	end
end

function LeaderboardManager:resetStat(player, stat)
	local stat = LeaderboardManager:getStat(player, stat)
	
	if stat then		
		for i, defaultStat in pairs(stats) do
			if (stat == defaultStat.Name) then
				stat.Value = defaultStat.DefaultValue	
				return
			end
		end
		
		stat.Value = 0
	end
end

function LeaderboardManager:resetStats(player)
	local leaderstats = player:FindFirstChild("CustomLeaderstats")
	if not leaderstats then return "No leaderstats found" end
		
	local stats = leaderstats:GetChildren()
	
	for i, stat in pairs(stats) do
		LeaderboardManager:resetStat(player, stats)
	end
end

return LeaderboardManager
