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)