O'k so i am making a script that will go into bricks, so anyway i want the script to activate a function when "OnTouched" then find how much pressure is being put on the brick, and then if it goes past the limit ":BreakJoints()" so how can i find how much pressure/weight is being put on the brick?
Depends on your definition of weight. I will assume you mean mass, but if you want the force of gravity exerted by the brick/model, simply multiple the mass by the acceleration do to Gravity (game.Workspace.Gravity, where 196.2 is the default).
Getting the mass of a part is simple, as they all have the function GetMass.
As for getting the mass of a model, we are going to need a custom function for that. All you have to do is look for every descendant that inherits from BasePart and sum together the mass of all of these objects. This is most easily done using recursion:
function GetDescendantMass(parent) local sum = 0 for _, child in ipairs(parent:GetChildren()) do if child:IsA("BasePart") then sum = sum + child:GetMass() end sum = sum + GetDescendantMass(child) end return sum end
To use this function simply pass in the model you want to get the mass of as the argument.