Locally removing every glass-material parts

Hello !

I’m currently helping someone with a very-detailed place, mainly constituted of glass-parts.

The problem with the glass material is the light-deformation effect, it causes a lot of lags when the amount of light starts to exceed people’s graphic resource limit.

What’s the best way to replace glass-parts into transparent plastic ?

What I've thought so far
  • Getting every parts in a large region using region3 method, then using a for loop to do something with them. But the problem persists, how do I transform into local parts?

  • Using the same method and re-building(or cloning) every glass instances into plastic

Thanks for answering !

If you’re trying to replace them permanently in Studio, try using GetDescendants on the Workspace or a specific model, then check if each one is a BasePart and has Material set to Glass, and modify it in some way.

If you’re trying to replace the materials in-game, check out CollectionService and tag each glass part (maybe using the same method as above, calling CollectionService:AddTag on each one). Then use GetTagged for existing parts and GetInstanceAddedSignal for any new ones.

Thanks for the answer,

Is there a way to make this system dynamic ?

The goal is not to specify each parts, as I mentionned region3 method I prefer a system that indexs every parts in the workspace.

You could use Workspace:GetDescendants to check each object in the Workspace, and Workspace.DescendantAdded to check any parts added later. If you’re doing it on the client then you might want to use both even if parts are not added mid-game, in case the script runs before all the parts are replicated.

1 Like