I’m making a script to apply the material variant to all parts in workspace but it seems not to be applying the variant, could someone fix the script.
local materialToVariant = {
[Enum.Material.Plastic] = MaterialService.PlasticVariant.Name,
[Enum.Material.SmoothPlastic] = MaterialService.SmoothPlasticVariant.Name,
[Enum.Material.Metal] = MaterialService.MetalVariant.Name,
[Enum.Material.Fabric] = MaterialService.FabricVariant.Name,
}
for _, part in pairs(game.Workspace:GetDescendants()) do if part:IsA("BasePart") then local variant = materialToVariant[part.Material] if variant then part.MaterialVariant = variant end end end