Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
ValueCurveKey
A time-value pair used with ValueCurve instances.
The Interpolation property dictates the interpolation mode for the segment started by this key and ended by the next key on the curve. Each segment may use a different interpolation mode.
The LeftTangent and RightTangent properties apply to the cubic interpolation mode and define the desired tangent (slope) at the key. Different left and right values can be used to encode discontinuities in slope at the key. Attempting to set a RightTangent value on a key that doesn't use the cubic interpolation mode will result in a runtime error. It is possible to set the LeftTangent property on any key, as it will be used should the preceding segment use cubic interpolation.
Constructors
| Name | Type / Returns | Description |
|---|---|---|
| ValueCurveKey.new | Returns a new ValueCurveKey from the given time and value. |
ValueCurveKey.new
Creates a new ValueCurveKey at a given time and value. LeftTangent and RightTangent are left uninitialized and, if not initialized, tangent values of '0' will be used when evaluating the curve.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| time | number | Time at which to create the new ValueCurveKey. | |
| value | any | Value of the new ValueCurveKey. | |
| Interpolation | KeyInterpolationMode | The interpolation mode for the curve segment starting at this key. Defaults to KeyInterpolationMode.Constant if omitted. |
Properties
| Name | Type / Returns | Description |
|---|---|---|
| ValueCurveKey.Interpolation | KeyInterpolationMode | The key interpolation mode for the segment started by this ValueCurveKey. |
| ValueCurveKey.Time | number | The time position of this ValueCurveKey. |
| ValueCurveKey.Value | any | The value of this ValueCurveKey. |
| ValueCurveKey.RightTangent | number | The tangent to the right of this ValueCurveKey. |
| ValueCurveKey.LeftTangent | number | The tangent to the left of this ValueCurveKey. |
ValueCurveKey.Interpolation
Specifies the interpolation mode used for the curve segment that begins at this key and ends at the next key on the ValueCurve. Each segment of the curve can use a different interpolation mode. The default value is KeyInterpolationMode.Constant.
The available modes are:
- Constant — the segment holds the value of this key until the next key.
- Linear — the segment linearly interpolates between this key's value and the next key's value.
- Cubic — the segment uses a cubic Hermite spline defined by this key's
RightTangentand the next key'sLeftTangent.
Not all value types support Linear or Cubic interpolation. Non-numerical types such as strings, booleans, and enums revert to Constant interpolation regardless of this setting.
Changing this property to a non-cubic mode automatically clears the RightTangent of this key, because only cubic segments use a right tangent.
| Field | Value |
|---|---|
| type | KeyInterpolationMode |
ValueCurveKey.Time
The time position of this ValueCurveKey along the curve. Defaults to 0. Keys within a ValueCurve are stored sorted by their time values; the time determines where in the animation timeline this key's value applies.
| Field | Value |
|---|---|
| type | number |
ValueCurveKey.Value
The value stored in this ValueCurveKey. Defaults to nil. Can hold any supported Luau type, including numbers, booleans, strings, Vector2, Vector3, CFrame, UDim, UDim2, NumberRange, NumberSequence, ColorSequence, and enums. All keys on a single ValueCurve must hold values of the same type; attempting to insert a key whose value type differs from existing keys produces an error.
| Field | Value |
|---|---|
| type | any |
ValueCurveKey.RightTangent
The outgoing tangent (slope) at this key, used when the Interpolation is KeyInterpolationMode.Cubic. Defaults to nil (unset); when unset, an effective tangent of 0 is used during curve evaluation. Attempting to set this property on a key whose interpolation mode is not Cubic throws a runtime error. This property is automatically cleared when Interpolation is changed to a non-cubic mode.
| Field | Value |
|---|---|
| type | number |
ValueCurveKey.LeftTangent
The incoming tangent (slope) at this key, used when the preceding segment uses KeyInterpolationMode.Cubic interpolation. Defaults to nil (unset); when unset, an effective tangent of 0 is used during curve evaluation. Unlike RightTangent, this property can be set on any key regardless of its own interpolation mode, because it defines the slope at the endpoint of the preceding cubic segment.
| Field | Value |
|---|---|
| type | number |