Help with making a custom physic system?

Im in the process of making a custom physics system, this physics system responds to weight and will indicate “stress” on parts, when their stress is great enough, the part will break.

however I am having some issues with it, the plan is to have it look something like this:


the brighter areas indicate the least amount of stress, the brick surface is the “anchor point” were the most stability originates. from there parts that stack will check if they are being supported by something below them and adjust their stability accordingly, if theres nothing below them like the parts hanging on the left, they get the stability from surrrounding parts and change their stability to that number.

but I found that something is causing the stability to stack, if there is enough parts they will all start to accumulate stability and will overload each other, I don’t want this I just want parts to lose stability as they get further from a stable point (and no I cant use magnitude they have to use the stability from surrounding parts).

heres the script so far:

local strength = 50

function changestability(result,touching,part)
	if result ~= nil and result.Name == "PhysicsAnchor" then
		part.Stability.Value = strength
	
	elseif result ~= nil and result.Name ~= "PhysicsAnchor" and result:FindFirstChild("Stability") then
		local totalstrength = 0
		for _, p in pairs(part:GetConnectedParts(false)) do
			local s = p.Stability.Value
			if s > 0 then
			totalstrength = totalstrength + s
			end
		end
		local convert = totalstrength * .325
		part.Stability.Value = convert
		
		
	elseif result == nil then
		local totalstrength = 0
		for _, p in pairs(part:GetConnectedParts(false)) do
			local s = p.Stability.Value
			if s > 0 then
			totalstrength = totalstrength + s
			end
		end
		local convert = totalstrength * .125
		part.Stability.Value = convert
	end
	
end






function stabilitycheck(part)
	local y = part.Size.Y * .5 + 0.5
	local ray = Ray.new(part.Position,Vector3.new(0,-y,0))
	local raypart = workspace:FindPartOnRay(ray)
	
	local filteredparts = {}
	local parts = part:GetTouchingParts()
	for _, p in next, parts do
		if p:IsA("BasePart") and p.Anchored == false then
			table.insert(filteredparts,p)
		end
	end
	
	return raypart,filteredparts
end




while true do
	wait()
	local c = script.Parent:GetChildren()
	for i = 1, #c do
		if c[i]:IsA("BasePart") and c[i]:FindFirstChild("Stability") then
			if c[i].Stability.Value <= 0 then
				c[i].Color = Color3.fromRGB(255,255,255)
				
			elseif c[i].Stability.Value > 0 then
				local colconvert = 5 * c[i].Stability.Value
				if colconvert > 255 then
					colconvert = 255
				end
				c[i].Color = Color3.fromRGB(colconvert,0,0)
			end
			
			local check,touching = stabilitycheck(c[i])
				changestability(check,touching,c[i])
		end
	end
end