# Vector4.WithZ

```csharp
Vector4 WithZ(float z)
```

Returns this vector with given Z component.

### Parameters

- `z` (`float`): The override for Z component.

### Returns

`Vector4`: The new vector.

Declared in [Vector4](/api/Vector4).
Assembly: `Sandbox.System`.
