Need help with blueprint filling system like lumber tycoon 2

so basically im trying to make a blueprint filling system like lt2 but whenever i put a second part in to fill the blueprint the number for like how full it is doesnt go up

i have really messy code here but hopefully you guys can help me thanks!

game:GetService("RunService").Heartbeat:Connect(function()
	local Ratio = 0
	for _, Blueprint in pairs(game.Workspace.Blueprints:GetDescendants()) do
		if Blueprint.Name == "BoundingBox" then
			
			if Blueprint.BillboardGui then
				Blueprint.BillboardGui.Frame.TextLabel.Text = Ratio
			end
			
			local function GetTouchingParts(part)
				local connection = part.Touched:Connect(function() end)
				local results = part:GetTouchingParts()
				connection:Disconnect()
				return results
			end
			for _, Log in pairs(GetTouchingParts(Blueprint)) do
				if Log.Name == "Log" or Log.Name == "Trunk" then
					local Value = (Log.Size.X * Log.Size.Y * Log.Size.Z)
					local UnitsToFill = Blueprint.Parent:GetAttribute("UnitsToFill")
					Ratio = Value / UnitsToFill
					Ratio = math.floor(Ratio * 100 + 0.5)
					Blueprint.BillboardGui.Frame.TextLabel.Text = Ratio
					if Ratio >= 100 then
						Blueprint.Transparency = 0
						Blueprint:ClearAllChildren()
						Log:Destroy()
					for _, parts in pairs(Blueprint.Parent:GetChildren()) do
						if parts.Name ~= "BoundingBox" then
								parts.CanCollide = true
							end
						end
					end
				end
			end
		end
	end
end)

The problem is that you didn’t add the ratio of the new part to the ratio of the old part. Perhaps this would work.

local RunService = game:GetService("RunService")

local bluePrints = {}
local ratios = {}

local function GetTouchingParts(part)
	local connection = part.Touched:Connect(function() end)
	local results = part:GetTouchingParts()
	connection:Disconnect()
	return results
end

local function updateRatios()
	for i, bluePrint in ipairs(bluePrints) do
		local touchingParts = getTouchingParts(bluePrint)
		for _, log in ipairs(touchingParts) do
			if log.Name ~= "Log" then
				continue
			end
			local volume = log.Size.X * log.Size.Y * log.Size.Z
			local ratioAdd = volume / Blueprint.Parent:GetAttribute("UnitsToFill")
			local newRatio = ratios[i] + ratioAdd
			ratios[i] = newRatio
			
			Blueprint.BillboardGui.Frame.TextLabel.Text = math.floor(newRatio * 100 + 0.5)
			
			if newRatio >= 1 then
				Blueprint.Transparency = 0
				Blueprint:ClearAllChildren()
				for i, log in ipairs(touchingParts) do
					if log.Name ~= "Log" then
						continue
					end
					log:Destroy()
				end
				for _, part in pairs(Blueprint.Parent:GetChildren()) do
					if part.Name ~= "BoundingBox" then
						part.CanCollide = true
					end
				end
				break
			end
		end
	end
end

local index = 0
for _, v in ipairs(workspace.Blueprints:GetDescendants()) do
	if v.Name == "BoundingBox" then
		index += 1
		bluePrints[index] = v
		ratios[index] = 0
	end
end

RunService.Heartbeat:Connect(updateRatios)