Materials
lists, defines, and replaces the materials that parts render with
Methods
6 members
- DefineMaterial
(spec: MaterialSpec, parent: string?) -> string[server] write the material file, define the material, and answer its asset id. An absent Name takes the next free store name
Parameters
Name Type Description spec MaterialSpec Textures, shaders, tints, and physical properties of the material. parent string? Material to inherit unset fields from. returns string — - GetMaterial
(idOrName: string) -> MaterialSpec read one material. An absent dataset is nil, never a flag
Parameters
Name Type Description idOrName string Identifier or name of the material to return. returns MaterialSpec — - GetMaterials
() -> {{Id: string, Name: string, Pipeline: string, Model: string}} list every material with its pipeline class and surface model
- ReloadMaterial
(idOrName: string) -> boolean[server] read the material file again and define the material in place
Parameters
Name Type Description idOrName string Identifier or name of the material to reload from disk. returns boolean — - RemoveMaterial
(idOrName: string, replacementIdOrName: string?) -> boolean[server] delete the material and its file. A material in use needs a replacement
Parameters
Name Type Description idOrName string Identifier or name of the material to remove. replacementIdOrName string? Material assigned to the surfaces that used the removed one. returns boolean — - ReplaceMaterial
(oldIdOrName: string, newIdOrName: string) -> boolean[server] retarget every surface to the new material and delete the old one
Parameters
Name Type Description oldIdOrName string Identifier or name of the material to replace. newIdOrName string Material assigned to the surfaces that used the replaced one. returns boolean —
Querying and Inspecting PBR Materials
Lifecycle: Shared
Material rows can be listed in bulk or fetched one at a time by name.
Luau
local allMats = game.Materials.GetMaterials()for _, mat in ipairs(allMats) do print("Material entry:", mat.Name, mat.Pipeline)endlocal rock = game.Materials.GetMaterial("Granite")if rock then print("Surface model:", rock.Model)end