Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.
1 | function GetMassOfModel(model) |
3 | for i, v in pairs (model:GetChildren()) do |
4 | if v:IsA( 'BasePart' ) or v:IsA( 'Union' ) then |
5 | mass = mass + v:GetMass() |
Something like that; When this function is called on a model (as the argument), it iterates through each object in the model specified, checks if it's a physical object, and then adds that object's mass into a total (the mass variable), returning the variable when it's done iterating.