-- update stats loop

while true do
	
	for _, player in ipairs(game.Players:GetPlayers()) do
		local leaderstats = player:FindFirstChild("leaderstats")
		if not leaderstats then
			continue
		end
		
		for _, statObject in ipairs(leaderstats:GetChildren()) do
			local saveValue = trackedStats[statObject.Name](player)
			if not saveValue then
				continue
			end
			statObject.Value = saveValue
		end
	end
	
	wait(1)
end
