4 min read

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

NameType / ReturnsDescription
ValueCurveKey.newReturns 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

NameTypeDefaultDescription
timenumberTime at which to create the new ValueCurveKey.
valueanyValue of the new ValueCurveKey.
InterpolationKeyInterpolationModeThe interpolation mode for the curve segment starting at this key. Defaults to KeyInterpolationMode.Constant if omitted.

Properties

NameType / ReturnsDescription
ValueCurveKey.InterpolationKeyInterpolationModeThe key interpolation mode for the segment started by this ValueCurveKey.
ValueCurveKey.TimenumberThe time position of this ValueCurveKey.
ValueCurveKey.ValueanyThe value of this ValueCurveKey.
ValueCurveKey.RightTangentnumberThe tangent to the right of this ValueCurveKey.
ValueCurveKey.LeftTangentnumberThe 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:

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.

FieldValue
typeKeyInterpolationMode

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.

FieldValue
typenumber

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.

FieldValue
typeany

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.

FieldValue
typenumber

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.

FieldValue
typenumber