Title, I've tried it and kinda works. The problem is, what if a model has more models inside it?
function optimize()
local parts = workspace:GetChildren()
for i,v in pairs(parts)do
if v:IsA("Model") then
local mParts = v:GetChildren()
for i,v in pairs(mParts) do
if v:IsA("BasePart") then
v.Material = Enum.Material.SmoothPlastic
end
end
elseif v:IsA("BasePart") then
v.Material = Enum.Material.SmoothPlastic
end
end
end

3 comments
Use GetDescendants for the workspace, it'll get every child even if it's inside of a model.
use GetDescendants
Thanks