Luduvo Contents
Theme
On this page

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
NameTypeDescription
specMaterialSpecTextures, shaders, tints, and physical properties of the material.
parentstring?Material to inherit unset fields from.
returnsstring—
GetMaterial(idOrName: string) -> MaterialSpec

read one material. An absent dataset is nil, never a flag

Parameters
NameTypeDescription
idOrNamestringIdentifier or name of the material to return.
returnsMaterialSpec—
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
NameTypeDescription
idOrNamestringIdentifier or name of the material to reload from disk.
returnsboolean—
RemoveMaterial(idOrName: string, replacementIdOrName: string?) -> boolean [server]

delete the material and its file. A material in use needs a replacement

Parameters
NameTypeDescription
idOrNamestringIdentifier or name of the material to remove.
replacementIdOrNamestring?Material assigned to the surfaces that used the removed one.
returnsboolean—
ReplaceMaterial(oldIdOrName: string, newIdOrName: string) -> boolean [server]

retarget every surface to the new material and delete the old one

Parameters
NameTypeDescription
oldIdOrNamestringIdentifier or name of the material to replace.
newIdOrNamestringMaterial assigned to the surfaces that used the replaced one.
returnsboolean—

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