CFrameValue

Show Deprecated

A container object for a single CFrame value.

Code Samples

Store the Camera's CFrame

1-- Create a CFrame that stores the camera's current position/orientation
2local vSnapshot = Instance.new("CFrameValue")
3vSnapshot.Value = workspace.CurrentCamera.CFrame
4vSnapshot.Name = "Snapshot"
5vSnapshot.Parent = workspace
6
7-- Later, we can load the CFrame back into the camera
8workspace.CurrentCamera.CFrame = vSnapshot.Value

Summary

Properties

Used to hold a CFrame value.

Events


Fired whenever the CFrameValue.Value of the CFrameValue is changed.

Methods

Properties

Value

Used to hold a CFrame value.

Events

Changed

Fired whenever the CFrameValue.Value of the CFrameValue is changed. It will run with the new value being stored in the argument object, instead of a string representing the property being changed.

This event, like other changed events, can be used to track when an CFrameValue changes and to track the different values that it may change to.

For instance, this even may be useful in games that rely on CFrameValues to track game object CFrame positions and movements.

Equivalent changed events exist for similar objects, such as NumberValue and StringValue, depending on what object type best suits the need.

Parameters

value: CFrame

The new value after the change.


Code Samples

CFrameValue.Changed

1workspace.CFrameValue.Changed:Connect(function(NewValue)
2 print(NewValue)
3end)
4
5workspace.CFrameValue.Value = CFrame.new(0, 20, 0)

Methods