First off, don't use a repeat loop for this. You'll want to use a for loop to iterate through any BasePart with mass. Like this...
local GetMass = function(Object)
local Mass = 0
Recursive = function(Parent)
for _,p in next,Parent:GetChildren() do
if p:IsA("BasePart") then
Mass = Mass + p:GetMass()
end
Recursive(p)
end
end
if Object:IsA("BasePart") then
Mass = Mass + Object:GetMass()
end
return Mass
end
What you're doing is putting a force in every single part of the model, I'm not sure but I believe this is breaking the welds. What you can do is put that force into a single object like this...
local MakeFloat = function(Object)
local Mass = GetMass(Object)
local AntiForce = Instance.new("BodyForce")
AntiForce.Force = Vector3.new(0,workspace.Gravity*Mass,0)
AntiForce.Parent = Object
end
Hope this helps!