# engineGetMaterialValue (Client)

> Reads a value the material sets: a parameter, a static switch or a `TARGET_n` output.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Materials and shaders
- **URL**: https://wiki.mymp.gg/en/engineGetMaterialValue

## Syntax

```lua
any engineGetMaterialValue(material material, string name)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `material` | `material` | The material. |
| `name` | `string` | The parameter's, switch's or output's name. |

## Returns

A number, a vector or an integer, by the parameter's type. A texture gives its name, or `true` when it is an image. A switch gives `true` or `false` (the shader's default when it was not set), and an output with a render target gives `true`. `nil` when the material does not set that name.

## Example

```lua
local material = engineCreateMaterial("surface")
engineSetMaterialValue(material, "roughnessFactor", 0.2)
outputDebugString(tostring(engineGetMaterialValue(material, "roughnessFactor")))
```

## See also

- [engineSetMaterialValue (Client)](https://wiki.mymp.gg/en/engineSetMaterialValue.md): Sets a material's value: a shader parameter, a static switch or the render target of a TARGET_n output.
- [engineResetMaterialValue (Client)](https://wiki.mymp.gg/en/engineResetMaterialValue.md): Drops a value the material set, or all of them, going back to what its base gives.
- [engineGetMaterialParameters (Client)](https://wiki.mymp.gg/en/engineGetMaterialParameters.md): Lists the parameters of the shader a material uses.
