I'm trying to make a script which I can put in the workspace / inside models that will make them regenrate to their original form after 50% or a specific number of parts are missing from it. I tried making this code, For some reason it's not working.
for i, part in pairs(script.Parent:GetDescendants()) do
if part:IsA("BasePart") then
parts = parts + 1
end
end
if parts <= 500 then
print("regenrating")
end
Thanks!
