Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
Camera
Inherits from: PVInstance → Instance → Object
The Camera object defines a view of the 3D world. In a running experience, each client has its own Camera object which resides in that client's local Workspace, accessible through the Workspace.CurrentCamera property.
The most important camera properties are:
CFramewhich represents the position and orientation of the camera.CameraTypewhich is read by the experience's camera scripts and determines how the camera should update each frame.CameraSubjectwhich is read by the experience's camera scripts and determines what object the camera should follow.FieldOfViewwhich represents the visible extent of the observable world.Focuswhich represents the point the camera is looking at. It's important this property is set, as certain visuals will be more detailed and will update more frequently depending on how close they are to the focus point.
See Customizing the Camera for more information on how to adjust and customize the camera's behavior.
Storing Multiple Cameras
Note that when changing Workspace.CurrentCamera to a new Camera, all other Cameras directly descending from Workspace will be destroyed. If you need to store multiple cameras and swap between them on demand, it's recommended that you store them in a Folder or Model under Workspace, inside which they will remain even when CurrentCamera is changed.
Inherits from: PVInstance
Memory category: Instances
Tags: NotReplicated
Properties
| Name | Type / Returns | Description |
|---|---|---|
| Camera.CameraSubject | Instance | The Humanoid or BasePart that is the Camera subject. |
| Camera.CameraType | CameraType | Specifies the CameraType to be read by the camera scripts. |
| Camera.CFrame | CFrame | The CFrame of the Camera, defining its position and orientation in the 3D world. |
| Camera.CoordinateFrame | CFrame | The old version of the CFrame property which functions identically to it. This item should be used in a LocalScript in order to work as expected online. |
| Camera.DiagonalFieldOfView | float | Sets the angle of the camera's diagonal field of view. |
| Camera.FieldOfView | float | Sets the angle of the camera's vertical field of view. |
| Camera.FieldOfViewMode | FieldOfViewMode | Determines the FOV value of the Camera that's invariant under viewport size changes. |
| Camera.Focus | CFrame | Sets the area in 3D space that is prioritized by Roblox's graphical systems. |
| Camera.focus | CFrame | |
| Camera.HeadLocked | boolean | Toggles whether the camera will automatically track the head motion of a player using a VR device. |
| Camera.HeadScale | float | Sets the scale of the user's perspective of the world when using VR. |
| Camera.MaxAxisFieldOfView | float | Sets the angle of the camera's field of view along the longest viewport axis. |
| Camera.NearPlaneZ | float | Describes the negative Z offset, in studs, of the camera's near clipping plane. |
| Camera.ViewportSize | Vector2 | The dimensions of the device safe area on a Roblox client. |
| Camera.VRTiltAndRollEnabled | boolean | Toggles whether to apply tilt and roll from the CFrame property while the player is using a VR device. |
Inherited from PVInstance
| Name | Type / Returns | Description |
|---|---|---|
| PVInstance.Origin | CFrame | Editor-only property that reads and sets the world CFrame of the PVInstance's pivot, moving the entire instance when changed from the Studio Properties window. |
| PVInstance.Pivot Offset | CFrame | Editor-only property that displays and edits the pivot's CFrame relative to the instance, moving only the pivot and leaving the instance in place. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.Archivable | boolean | Determines if an Instance and its descendants can be cloned using Instance:Clone(), and can be saved/published. |
| Instance.archivable | boolean | |
| Instance.Capabilities | SecurityCapabilities | The set of capabilities allowed to be used for scripts inside this container. |
| Instance.IsInSandbox | boolean | Indicates whether the instance is inside a sandboxed container. |
| Instance.Name | string | A non-unique identifier of the Instance. |
| Instance.Parent | Instance | Determines the hierarchical parent of the Instance. |
| Instance.PredictionMode | PredictionMode | Reflects the client-side prediction mode applied to the instance under server-authoritative physics. |
| Instance.RobloxLocked | boolean | A deprecated property that used to protect CoreGui objects. |
| Instance.Sandboxed | boolean | When enabled, the instance can only access abilities in its Capabilities list. |
| Instance.UniqueId | UniqueId | A unique identifier for the instance. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.ClassName | string | A read-only string representing the class this Object belongs to. |
| Object.className | string |
Camera.CameraSubject
CameraSubject accepts a variety of Instances. The default camera scripts respond differently to the available settings:
By default, the camera scripts follow the local character's
Humanoid, factoring in the humanoid's current state andHumanoid.CameraOffset.When set to a
BasePart, the camera scripts follow its position, with a vertical offset in the case ofVehicleSeats.
CameraSubject cannot be set to nil. Attempting to do so will revert it to its previous value.
To restore CameraSubject to its default value, set it to the local character's Humanoid:
| Field | Value |
|---|---|
| type | Instance |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Camera |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Basic"] |
Code samples: View on Creator Hub (Camera-CameraSubject).
Camera.CameraType
The default Roblox camera scripts have several built-in behaviors. Setting this property toggles between the various CameraType behaviors. Note that some camera types require a valid CameraSubject to work correctly.
The default camera scripts will not move or update the camera if CameraType is set to CameraType.Scriptable. For more information on positioning and orienting the camera manually, see CFrame.
For all CameraType settings except CameraType.Scriptable, the CameraSubject property represents the object whose position the camera's Focus is set to.
| Field | Value |
|---|---|
| type | CameraType |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Camera |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Basic"] |
Camera.CFrame
This property is the CFrame of the Camera, defining its position and orientation in the 3D world. Note that some transformations, such as the rotation of the head when using VR devices, are not reflected in this property, so you should use GetRenderCFrame() to obtain the "true" CFrame of the camera.
You can move the camera by setting this property. However, the default camera scripts also set it, so you should either:
Set the camera
CameraTypetoCameraType.Scriptableso that the default camera scripts will not update the camera'sCFrame. This method is simplest and recommended in most cases.Completely replace the default camera scripts with alternatives. This approach is only recommended if you do not need any default camera functionality.
The most intuitive way to position and orient the Camera is by using the CFrame.lookAt() constructor. In the following example, the Camera is positioned at Vector3.new(0, 10, 0) and is oriented to be looking towards Vector3.new(10, 0, 0).
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local pos = Vector3.new(0, 10, 0)
local lookAtPos = Vector3.new(10, 0, 0)
camera.CFrame = CFrame.lookAt(pos, lookAtPos) Although the camera can be placed in the manner demonstrated above, you may want to animate it to move smoothly from one CFrame to another. For this, you can either:
Set the camera's position/orientation every frame with
RunService:BindToRenderStep()and theCFrame:Lerp()method.Create and play a
Tweenthat animates the position/orientation of the camera:local Players = game:GetService("Players") local TweenService = game:GetService("TweenService") local camera = workspace.CurrentCamera camera.CameraType = Enum.CameraType.Scriptable local player = Players.LocalPlayer local character = player.Character if not character or character.Parent == nil then character = player.CharacterAdded:Wait() end local pos = camera.CFrame * Vector3.new(0, 20, 0) local lookAtPos = character.PrimaryPart.Position local targetCFrame = CFrame.lookAt(pos, lookAtPos) local tween = TweenService:Create(camera, TweenInfo.new(2), {CFrame = targetCFrame}) tween:Play()
| Field | Value |
|---|---|
| type | CFrame |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Basic"] |
| simulationAccess | true |
Camera.CoordinateFrame
Deprecated. This item has been superseded by Camera.CFrame which should be used in all new work.
The old version of the CFrame property which functions identically to it.
This item should be used in a LocalScript in order to work as expected online.
| Field | Value |
|---|---|
| type | CFrame |
| tags | ["Hidden","NotReplicated","Deprecated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":false} |
| capabilities | ["Basic"] |
| simulationAccess | true |
Camera.DiagonalFieldOfView
Sets how many degrees in the diagonal direction (from one corner of the viewport to its opposite corner) the camera can view. See FieldOfView for a more general explanation of field of view.
Note that DiagonalFieldOfView represents the field of view that is visible by the Camera rendering into the fullscreen area which may be occluded by notches or screen cutouts on some devices. See ViewportSize for more information.
| Field | Value |
|---|---|
| type | float |
| tags | ["NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Camera |
| serialization | {"can_load":false,"can_save":false} |
| capabilities | ["Basic"] |
Camera.FieldOfView
The FieldOfView (FOV) property sets how many degrees in the vertical direction the camera can view. This property is clamped between 1 and 120 degrees and defaults at 70. Very low or very high fields of view are not recommended as they can be disorientating to players.
Note that uniform scaling is enforced, meaning the vertical and horizontal field of view are always related by the aspect ratio of the screen.
Suggested uses for FieldOfView include:
- Reducing FOV to give the impression of magnification, for example when using binoculars.
- Increasing FOV when the player is "sprinting" to give the impression of a lack of control.
Note that FieldOfView represents the field of view that is visible by the Camera rendering into the fullscreen area which may be occluded by notches or screen cutouts on some devices. See ViewportSize for more information.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Camera |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Basic"] |
Camera.FieldOfViewMode
The camera's FieldOfView (FOV) must be updated to reflect ViewportSize changes. The value of FieldOfViewMode determines which FOV value will be kept constant.
For example, when this property is set to FieldOfViewMode.Vertical, the horizontal FOV is updated when the viewport is resized, but the vertical FOV is kept constant. If this property is set to FieldOfViewMode.Diagonal, both horizontal and vertical FOV might be changed to keep the diagonal FOV constant.
| Field | Value |
|---|---|
| type | FieldOfViewMode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Camera |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Basic"] |
Camera.Focus
Certain graphical operations the engine performs, such as updating lighting, can take time or computational effort to complete. The camera's Focus property tells the engine which area in 3D space to prioritize when performing such operations. For example, dynamic lighting from objects such as PointLights may not render at distances far from the focus.
The default Roblox camera scripts automatically set Focus to follow the CameraSubject (usually a Humanoid). However, Focus will not automatically update when CameraType is set to CameraType.Scriptable or when the default camera scripts are not being used. In these cases, you should update Focus every frame, using RunService:BindToRenderStep() method at the RenderPriority.Camera priority.
Focus has no bearing on the position or orientation of the camera; see CFrame for this.
| Field | Value |
|---|---|
| type | CFrame |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Basic"] |
| simulationAccess | true |
Camera.focus
Deprecated. This property is a deprecated variant of Focus which should be used instead.
| Field | Value |
|---|---|
| type | CFrame |
| tags | ["NotReplicated","Deprecated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":false} |
| capabilities | ["Basic"] |
Camera.HeadLocked
Toggles whether the camera will automatically track the head motion of a player using a VR device. When true (default), the engine combines CFrame with the UserCFrame of the user's head to render the player's view with head tracking factored in. The view will be rendered at the following CFrame:
local UserInputService = game:GetService("UserInputService")
local camera = workspace.CurrentCamera
local headCFrame = UserInputService:GetUserCFrame(Enum.UserCFrame.Head)
headCFrame = headCFrame.Rotation + headCFrame.Position * camera.HeadScale
-- This will be equivalent to Camera:GetRenderCFrame()
local renderCFrame = camera.CFrame * headCFrame It is recommended to not disable this property for the following reasons:
- Players may experience motion sickness if an equivalent head tracking solution is not added.
- The Roblox Engine performs latency optimizations when
HeadLockedis true.
See Also
VRService:GetUserCFrame()which can be used to obtain theCFrameof the head.VRService:RecenterUserHeadCFrame()which is used to recenter the head to the current position and orientation of the VR device.- The
GetRenderCFrame()method which returns theCFramecombined with theCFrameof the user's head.
| Field | Value |
|---|---|
| type | boolean |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Basic"] |
Camera.HeadScale
HeadScale is the scale of the user's perspective of the world when using VR.
The size of 1 stud in VR is 0.3 meters / HeadScale, meaning that larger HeadScale values equate to the world looking smaller from the user's perspective when using VR devices. For example, a part that's 1 stud tall appears to be 0.6 meters tall to a VR player with a HeadScale of 0.5.
This property is automatically controlled by VRService.AutomaticScaling to align the player's perspective with the size of their avatar. If you intend to control HeadScale yourself or use custom characters, toggle VRService.AutomaticScaling to VRScaling.Off.
This property should not be confused with Humanoid.HeadScale which is a NumberValue parented to a Humanoid to control its scaling.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Basic"] |
Camera.MaxAxisFieldOfView
The MaxAxisFieldOfView property sets how many degrees along the longest viewport axis the camera can view.
When the longest axis is the vertical axis, this property will behave similar to the FieldOfView property. This is generally the case when a device is in a portrait orientation. In a landscape orientation, the longest axis will be the horizontal axis; in this case, the property describes the horizontal field of view of the Camera.
| Field | Value |
|---|---|
| type | float |
| tags | ["NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Camera |
| serialization | {"can_load":false,"can_save":false} |
| capabilities | ["Basic"] |
Camera.NearPlaneZ
The NearPlaneZ property describes how far away the camera's near clipping plane is, in studs. The near clipping plane is a geometric plane that sits in front of the camera's CFrame. Anything between this plane and the camera will not render, creating a cutaway view when viewing objects at very short distances. The value of NearPlaneZ varies across different platforms and is currently always between -0.1 and -0.5.

| Field | Value |
|---|---|
| type | float |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":true} |
| capabilities | ["Basic"] |
Camera.ViewportSize
ViewportSize returns the dimensions of the device safe area on the current screen. This area is a rectangle which includes the Roblox top bar area but does not include any device notches or screen cutouts. The units of ViewportSize are Roblox UI offset units which may be different from native display pixels.

As noted above, ViewportSize is not equal to the fullscreen area size on displays with cutouts or notches. To obtain the fullscreen area size on all displays, you can query the AbsoluteSize property of a ScreenGui with ScreenInsets set to None. See ScreenInsets for a more information about how screen areas are defined.
Finally, note that ViewportSize is not the actual viewport size the camera uses for rendering (the camera renders in the fullscreen area). Also, the FieldOfView and DiagonalFieldOfView properties are based on the fullscreen area, not ViewportSize.
Camera Updates
Only the Camera currently referred to by Workspace.CurrentCamera has its ViewportSize updated each frame during the PreRender step. The ViewportSize of all other cameras in your experience won't be updated, including those used for ViewportFrames.
| Field | Value |
|---|---|
| type | Vector2 |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":true} |
| capabilities | ["Basic"] |
Camera.VRTiltAndRollEnabled
This property toggles whether to apply tilt and roll from the CFrame property while the player is using a VR device.
To prevent motion sickness, the horizon should remain level. Tilting and rolling the player's view while using a VR device can cause a disconnect between the player's physical space and the virtual space they are viewing. Changing the apparent downwards direction can cause players to lose balance or experience dizziness.
For these reasons, it is generally advisable to leave this property disabled, unless you have extensively tested your experience for these effects. Even with tilt and roll enabled, you may want to ensure the player always has a stable reference frame, such as the interior of a vehicle or a floor that can help the player ground themselves in their physical space.
| Field | Value |
|---|---|
| type | boolean |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["Basic"] |
Methods
| Name | Type / Returns | Description |
|---|---|---|
| Camera:GetLargestCutoffDistance | float | Returns how much the Camera needs to be pushed towards its Focus in order to make sure there is no obstructions between the Focus and CFrame. |
| Camera:GetPanSpeed | float | Returns the current 'pan' speed of the Camera. |
| Camera:GetPartsObscuringTarget | Instances | Returns an array of BaseParts that are obscuring the lines of sight between the camera's CFrame and the cast points. |
| Camera:GetRenderCFrame | CFrame | Returns the actual CFramewhere the Camera is being rendered, accounting for any roll applied and the impact of VR devices. |
| Camera:GetRoll | float | Returns in radians the current roll, or rotation around the camera's Z-axis, applied to the Camera using SetRoll(). |
| Camera:GetTiltSpeed | float | Returns the current tilt speed of the Camera. |
| Camera:Interpolate | () | Tweens the Camera in a linear fashion towards a new CFrame and Focus over a given duration. |
| Camera:PanUnits | () | Pans the Camera around the Focus in 45 degree increments around the Y axis. |
| Camera:ScreenPointToRay | Ray | Creates a unit Ray from a position on the screen (in pixels), at a set depth from the Camera orientated in the camera's direction. Accounts for the GUI inset. |
| Camera:SetCameraPanMode | () | Sets the CameraPanMode to be used by the Camera on mobile devices. |
| Camera:SetRoll | () | Sets the current rotation applied around the camera's Z-axis. |
| Camera:TiltUnits | boolean | Tilts the Camera around its Focus in 10 degree increments around the camera's X axis. |
| Camera:ViewportPointToRay | Ray | Creates a unit Ray from a position on the viewport (in pixels), at a given depth from the Camera, orientated in the camera's direction. Does not account for the CoreUISafeInsets inset. |
| Camera:WorldToScreenPoint | Tuple | Returns the screen location and depth of a Vector3 worldPoint and whether this point is within the bounds of the screen. Accounts for the GUI inset. |
| Camera:WorldToViewportPoint | Tuple | Returns the screen location and depth of a Vector3 worldPoint and whether this point is within the bounds of the screen. Does not account for the GUI inset. |
| Camera:ZoomToExtents | () | Adjusts the CFrame so that the specified bounding box is fully visible within the camera's viewport. |
Inherited from PVInstance
| Name | Type / Returns | Description |
|---|---|---|
| PVInstance:GetPivot | CFrame | Gets the pivot of a PVInstance. |
| PVInstance:PivotTo | () | Transforms the PVInstance along with all of its descendant PVInstances such that the pivot is now located at the specified CFrame. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance:AddTag | () | Applies a tag to the instance. |
| Instance:children | Instances | Returns an array of the object's children. |
| Instance:ClearAllChildren | () | This method destroys all of an instance's children. |
| Instance:Clone | Instance | Create a copy of an instance and all its descendants, ignoring instances that are not Archivable. |
| Instance:clone | Instance | |
| Instance:Destroy | () | Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy() on all children. |
| Instance:destroy | () | |
| Instance:FindFirstAncestor | Instance? | Returns the first ancestor of the Instance whose Instance.Name is equal to the given name. |
| Instance:FindFirstAncestorOfClass | Instance? | Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className. |
| Instance:FindFirstAncestorWhichIsA | Instance? | Returns the first ancestor of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstChild | Instance? | Returns the first child of the Instance found with the given name. |
| Instance:findFirstChild | Instance | |
| Instance:FindFirstChildOfClass | Instance? | Returns the first child of the Instance whose ClassName is equal to the given class name. |
| Instance:FindFirstChildWhichIsA | Instance? | Returns the first child of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstDescendant | Instance? | Returns the first descendant found with the given Instance.Name. |
| Instance:GetActor | Actor? | Returns the Actor associated with the Instance, if any. |
| Instance:GetAttribute | Variant | Returns the value which has been assigned to the given attribute name. |
| Instance:GetAttributeChangedSignal | RBXScriptSignal | Returns an event that fires when the given attribute changes. |
| Instance:GetAttributes | Dictionary | Returns a dictionary of the instance's attributes. |
| Instance:GetChildren | Instances | Returns an array containing all of the instance's children. |
| Instance:getChildren | Instances | |
| Instance:GetDebugId | string | Returns a coded string of the debug ID used internally by Roblox. |
| Instance:GetDescendants | Instances | Returns an array containing all of the descendants of the instance. |
| Instance:GetFullName | string | Returns a string describing the instance's ancestry. |
| Instance:GetStyled | Variant | Returns the styled or explicitly modified value of the specified property, or else the default property value if it hasn't been styled/modified. |
| Instance:GetStyledPropertyChangedSignal | RBXScriptSignal | Returns an event that fires when the given style property changes on the instance. |
| Instance:GetTags | Array | Gets an array of all tags applied to the instance. |
| Instance:HasTag | boolean | Check whether the instance has a given tag. |
| Instance:IsAncestorOf | boolean | Returns true if an Instance is an ancestor of the given descendant. |
| Instance:IsDescendantOf | boolean | Returns true if an Instance is a descendant of the given ancestor. |
| Instance:isDescendantOf | boolean | |
| Instance:IsPropertyModified | boolean | Returns true if the value stored in the specified property is not equal to the code-instantiated default. |
| Instance:QueryDescendants | Instances | Returns an array containing all descendants of the instance that match the selector string. |
| Instance:Remove | () | Sets the object's Parent to nil, and does the same for all its descendants. |
| Instance:remove | () | |
| Instance:RemoveTag | () | Removes a tag from the instance. |
| Instance:ResetPropertyToDefault | () | Resets a property to its default value. |
| Instance:SetAttribute | () | Sets the attribute with the given name to the given value. |
| Instance:WaitForChild | Instance | Returns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object:GetPropertyChangedSignal | RBXScriptSignal | Get an event that fires when a given property of the object changes. |
| Object:IsA | boolean | Returns true if an object's class matches or inherits from a given class. |
| Object:isA | boolean |
Camera:GetLargestCutoffDistance
Deprecated. This method is deprecated. Do not use it for new work.
This method is used by PopperCam in the default camera scripts to ensure obstructions do not come between the Camera and its subject.
This method will check all BaseParts and Terrain in the Workspace with the following exceptions:
- Any
Instancespecified in theignoreList(including its descendants) will be ignored BasePartswithBasePart.CanCollideset to false are ignoredBasePartswith aBasePart.Transparencygreater than 0.95 will be ignored WaterTerrainis ignored
Note, as this method requires an ignoreList to run, you should pass an empty table when none is required.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| ignoreList | Instances | An array of Instances to ignore. Descendants of these instances will also be ignored. |
Returns
| Type | Description |
|---|---|
| float | The distance, in studs, that the Camera needs to be pushed towards its Focus to ensure there are no obstructions between the Focus and CFrame of the Camera. |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["Basic"] |
Camera:GetPanSpeed
Deprecated. This method has been deprecated and no longer works. It should not be used in new work.
This method is broken and should not be used.
This method returns the current pan speed of the Camera.
The pan speed of the Camera describes the speed at which the Camera is rotating around its Focus around the Y axis.
Returns
| Type | Description |
|---|---|
| float | The speed at which the Camera is rotating around its Focus on the Y axis. |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["Basic"] |
Camera:GetPartsObscuringTarget
This method returns an array of BaseParts that are obscuring the lines of sight between the camera's CFrame and Vector3 positions in the castPoints array. Any Instances included in the ignoreList array will be ignored, along with their descendants.
The castPoints parameter is given as an array of Vector3 positions. Note that the array of BaseParts returned is in an arbitrary order, and no additional raycast data is provided. If you need data such as hit position, hit material, or surface normal, you should opt for the WorldRoot:Raycast() method.
local camera = workspace.CurrentCamera
local castPoints = {
Vector3.new(0, 10, 0),
Vector3.new(0, 15, 0)
}
local ignoreList = {}
local partsObscuringTarget = camera:GetPartsObscuringTarget(castPoints, ignoreList) If Terrain obscures a cast point, BaseParts obscuring the cast point between the obscuring Terrain and the cast point will not be returned.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| castPoints | Array | An array of Vector3 positions of cast points. | |
| ignoreList | Instances | An array of Instances that should be ignored, along with their descendants. |
Returns
| Type | Description |
|---|---|
| Instances | An array of BaseParts that obscure the lines of sight between the camera's CFrame and the castPoints. |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["Basic"] |
Camera:GetRenderCFrame
This method returns the actual CFrame of the Camera as it is rendered, including the impact of VR (VR head transformations are not applied to the CFrame property, so it is best practice to use GetRenderCFrame() to obtain the "true" CFrame of a player's view).
For example, when using VR, the Camera is actually rendered at the following CFrame:
local UserInputService = game:GetService("UserInputService")
local camera = workspace.CurrentCamera
local headCFrame = UserInputService:GetUserCFrame(Enum.UserCFrame.Head)
headCFrame = headCFrame.Rotation + headCFrame.Position * camera.HeadScale
renderCFrame = camera.CFrame * headCFrame The camera's render CFrame will only be changed to account for the head when the HeadLocked property is true.
Returns
| Type | Description |
|---|---|
| CFrame | The CFrame the Camera is being rendered at. |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["Basic"] |
Camera:GetRoll
Deprecated. This method has been deprecated.
This method returns, in radians, the current roll applied to the Camera using SetRoll(). Roll is defined as rotation around the camera's Z-axis.
This method only returns roll applied using the SetRoll() method. Roll manually applied to the camera's CFrame is not accounted for. To obtain the actual roll of the Camera, including roll manually applied, you can use the following snippet:
Returns
| Type | Description |
|---|---|
| float | The current roll applied by SetRoll(), in radians. |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["Basic"] |
Code samples: View on Creator Hub (Camera-GetRoll1, Camera-GetRoll).
Camera:GetTiltSpeed
Deprecated. This method has been deprecated and no longer works.
This method is broken and should not be used.
This method returns the current tilt speed of the Camera.
The tilt speed of the Camera describes the speed at which the Camera is rotating around its Focus around the camera's X axis.
Returns
| Type | Description |
|---|---|
| float | The speed at which the Camera is rotating around its Focus around the camera's X axis. |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["Basic"] |
Camera:Interpolate
Deprecated. This method has been deprecated. Instead use TweenService to smoothly animate the Camera, see the code snippets below for an example.
This method tweens the Camera in a linear fashion towards a new CFrame and Focus over a given duration, for example:
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera:Interpolate(
CFrame.new(0, 10, 100),
CFrame.new(0, 0, 100),
5
) Throughout the tween, the camera's CFrame will be orientated towards the camera's Focus.
When the tween has completed, the camera's InterpolationFinished event will fire.
If this method is called while the Camera is already tweening, the older tween will be stopped (without firing InterpolationFinished) and overridden by the new tween.
Interpolate can only be used if the current CameraType is Scriptable, regardless of whether the default camera scripts are being used. If it is used with any other CameraType an error will be thrown.
You are advised to use TweenService to tween the Camera instead as it is more reliable and offers a variety of easing styles. See below for an example:
local TweenService = game:GetService("TweenService")
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local tween = TweenService:Create(
camera,
TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{
CFrame = CFrame.new(0, 10, 100),
Focus = CFrame.new(0, 0, 100)
}
)
tween:Play() Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| endPos | CFrame | The CFrame for the Camera to tween to. | |
| endFocus | CFrame | The CFrame for the camera's Focus to tween to. | |
| duration | float | The duration, in seconds, of the tween. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["Basic"] |
Camera:PanUnits
Deprecated. This method was used for legacy camera controls and has since been deprecated. Do not use in new work.
This method pans the Camera around the Focus in 45 degree increments around the Y axis.
The rotation is applied to the camera's CFrame property.
This method pans the Camera in 45 degree increments, for example:
workspace.CurrentCamera:PanUnits(1) -- 45 degrees
workspace.CurrentCamera:PanUnits(-2) -- -90 degrees PanUnits does not require the CameraType to be Scriptable.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| units | int | The number of 45 degree increments by which to pan the Camera. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["Basic"] |
Camera:ScreenPointToRay
This method creates a unit Ray from a 2D position on the screen (defined in pixels), accounting for the GUI inset. The Ray originates from the Vector3 equivalent of the 2D position in the world at the given depth (in studs) away from the Camera.
As this method acknowledges the GUI inset, the offset applied to GUI elements (such as from the top bar) is accounted for. This means the screen position specified will start in the top left corner below the top bar. For an otherwise identical method that does not account for the GUI offset, use ViewportPointToRay().
As the Ray created is a unit ray, it is only one stud long. To create a longer ray, you can do the following:
local camera = workspace.CurrentCamera
local length = 500
local unitRay = camera:ScreenPointToRay(100, 100)
local extendedRay = Ray.new(unitRay.Origin, unitRay.Direction * length) This method only works for the current Workspace camera. Other cameras, such as those you create for a ViewportFrame, have an initial viewport size of (1, 1) and are only updated after you set them to Workspace.CurrentCamera. The mismatch in viewport size causes the camera to return a ray with an incorrect Ray.Direction.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| x | float | The position on the X axis, in pixels, of the screen point at which to originate the Ray. This position accounts for the GUI inset. | |
| y | float | The position on the Y axis, in pixels, of the screen point at which to originate the Ray. This position accounts for the GUI inset. | |
| depth | float | 0 | The depth from the Camera, in studs, from which to offset the origin of the Ray. |
Returns
| Type | Description |
|---|---|
| Ray | A unit Ray, originating from the equivalent Vector3 world position of the given screen coordinates at the given depth away from the Camera. This ray is orientated in the direction of the Camera. |
| Field | Value |
|---|---|
| security | None |
| thread safety | Safe |
| capabilities | ["Basic"] |
Camera:SetCameraPanMode
Deprecated. This method has been deprecated and should not be used in new work.
This method sets the CameraPanMode to be used by the Camera on mobile devices.
When the *'EdgeBump' CameraPanMode is used, swipe to pan is disabled and the edge bump camera controls are enabled.
SetCameraPan mode has no effect on Windows or Mac users.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| mode | CameraPanMode | Classic | The CameraPanMode to set the Camera to. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["Basic"] |
Camera:SetRoll
Deprecated. This method has been deprecated. Instead use the CFrame property to 'roll' the Camera.
This method is outdated and no longer considered best practice.
This method sets the current roll, in radians, of the Camera. The roll is applied after the CFrame and represents the rotation around the camera's Z-axis.
For example, the following would invert the Camera:
workspace.CurrentCamera:SetRoll(math.pi) -- math.pi radians = 180 degrees SetRoll has no effect on any roll applied using the CFrame property. Roll applied using SetRoll is not reflected in the CFrame property but is reflected in the CFrame returned byGetRenderCFrame().
This method can only be used when the CameraType is set to Scriptable, regardless of whether the default camera scripts are being used. If it is used with any other CameraType a warning is given in the output.
Any roll applied using this method will be lost when the CameraType is changed from Scriptable.
To obtain the roll set using this method use GetRoll().
As this method is outdated, you are advised to instead apply roll to the Camera using the CFrame property. For example:
local currentCFrame = workspace.CurrentCamera.CFrame
local rollCFrame = CFrame.Angles(0, 0, roll)
workspace.CurrentCamera.CFrame = currentCFrame * rollCFrame Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| rollAngle | float | The roll angle, in radians, to be applied to the Camera. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["Basic"] |
Camera:TiltUnits
Deprecated. This method was used for legacy camera controls and has been deprecated. Do not use in new work.
This method tilts the Camera by rotating it around the Focus around the camera's X axis by a given multiple of 10 degrees.
The rotation is applied to the camera's CFrame property and is constrained between -81.05 and 81.05 degrees.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| units | int | The number of 10 degree units by which to tilt the Camera. |
Returns
| Type | Description |
|---|---|
| boolean | Whether the Camera tilt applied was constrained. |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["Basic"] |
Camera:ViewportPointToRay
This method creates a unit Ray from a 2D position in device safe viewport coordinates, defined in pixels. The ray originates from the Vector3 equivalent of the 2D position in the world at the given depth (in studs) away from the Camera.
As illustrated below, (0, 0) corresponds to the top‑left point of the Roblox top bar. This means that the input 2D position does not account for the CoreUISafeInsets inset, but it does account for any DeviceSafeInsets.

Note that UI instances use a different coordinate system (GuiObject.AbsolutePosition uses the CoreUISafeInsets viewport coordinate system while this method uses the DeviceSafeInsets viewport coordinate system). If you would like to specify position in core UI coordinates, please use ScreenPointToRay().
Also note that this method only works for the Workspace.CurrentCamera camera. Other cameras, such as those you create for a ViewportFrame, have an initial viewport size of (1, 1) and are only updated after you set them to CurrentCamera. The mismatch in viewport size causes the camera to return a ray with an incorrect Ray.Direction.
This method can be used in conjunction with the ViewportSize property to create a ray from the centre of the screen, for example:
local camera = workspace.CurrentCamera
local viewportPoint = camera.ViewportSize / 2
local unitRay = camera:ViewportPointToRay(viewportPoint.X, viewportPoint.Y, 0) As the Ray created is a unit ray, it is only one stud long. To create a longer ray, you can do the following:
local camera = workspace.CurrentCamera
local length = 500
local viewportPoint = camera.ViewportSize / 2
local unitRay = camera:ViewportPointToRay(viewportPoint.X, viewportPoint.Y, 0)
local extendedRay = Ray.new(unitRay.Origin, unitRay.Direction * length) Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| x | float | The position on the X axis, in pixels, of the viewport point at which to originate the Ray, in device safe area coordinates. | |
| y | float | The position on the Y axis, in pixels, of the viewport point at which to originate the Ray, in device safe area coordinates. | |
| depth | float | 0 | The depth from the Camera, in studs, from which to offset the origin of the Ray. |
Returns
| Type | Description |
|---|---|
| Ray | A unit Ray, originating from the equivalent Vector3 world position of the given viewport coordinates at the given depth away from the Camera. This ray is orientated in the direction of the Camera. |
| Field | Value |
|---|---|
| security | None |
| thread safety | Safe |
| capabilities | ["Basic"] |
Camera:WorldToScreenPoint
This method returns the screen location and depth of a Vector3 worldPoint and whether this point is within the bounds of the screen.
This method takes in account the current GUI inset, such as the space occupied by the top bar, meaning that the 2D position returned is in the same term as GUI positions and can be used to place GUI elements. For an otherwise identical method that ignores the GUI inset, see WorldToViewportPoint().
local camera = workspace.CurrentCamera
local worldPoint = Vector3.new(0, 10, 0)
local vector, onScreen = camera:WorldToScreenPoint(worldPoint)
local screenPoint = Vector2.new(vector.X, vector.Y)
local depth = vector.Z Note this method does not perform any raycasting and the boolean indicating whether worldPoint is within the bounds of the screen will be true regardless of whether the point is obscured by BaseParts or Terrain.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| worldPoint | Vector3 | The Vector3 world position. |
Returns
| Type | Description |
|---|---|
| Tuple | A tuple containing, in order: - A Vector3 whose X and Y components represent the offset of the worldPoint from the top left corner of the screen, in pixels. The Vector3 Z component represents the depth of the worldPoint from the screen (in studs). - A boolean indicating if the worldPoint is within the bounds of the screen. |
| Field | Value |
|---|---|
| security | None |
| thread safety | Safe |
| capabilities | ["Basic"] |
Camera:WorldToViewportPoint
This method returns the screen location and depth of a Vector3 worldPoint and whether this point is within the bounds of the screen.
This method does not take in account the current GUI inset, such as the space occupied by the top bar, meaning that the 2D position returned is taken from the top left corner of the viewport. Unless you are using ScreenGui.IgnoreGuiInset, this position is not appropriate for placing GUI elements.
For an otherwise identical method that accounts for the GUI inset, see WorldToScreenPoint().
local camera = workspace.CurrentCamera
local worldPoint = Vector3.new(0, 10, 0)
local vector, onScreen = camera:WorldToViewportPoint(worldPoint)
local viewportPoint = Vector2.new(vector.X, vector.Y)
local depth = vector.Z Note this method does not perform any raycasting and the boolean indicating whether worldPoint is within the bounds of the screen will be true regardless of whether the point is obscured by BaseParts or Terrain.
ViewportFrame Cameras
Only Workspace.CurrentCamera has its internal viewport dimensions updated by the engine each frame. Cameras used inside a ViewportFrame do not receive viewport updates, so the X and Y components returned by this method will be in the range [0, 1] rather than in pixels. In practice, this means the returned values can be used as scale coordinates (for example, UDim2.fromScale(vector.X, vector.Y)) to position GUI elements relative to the ViewportFrame.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| worldPoint | Vector3 | The Vector3 world position. |
Returns
| Type | Description |
|---|---|
| Tuple | A tuple containing, in order: - A Vector3 whose X and Y components represent the offset of the worldPoint from the top left corner of the viewport, in pixels for Workspace.CurrentCamera. For cameras inside a ViewportFrame, the values are normalized to [0, 1]. The Vector3 Z component represents the depth of the worldPoint from the screen (in studs). - A boolean indicating if the worldPoint is within the bounds of the screen. |
| Field | Value |
|---|---|
| security | None |
| thread safety | Safe |
| capabilities | ["Basic"] |
Camera:ZoomToExtents
This method adjusts the CFrame so that a specified bounding box is fully visible within the camera's viewport, without cropping any part of the box.
The bounding box is defined by its center and orientation (boundingBoxCFrame) and its size (boundingBoxSize).
This can be used to focus the camera on a 3D object or model, such as when framing content in a ViewportFrame, taking screenshots, or smoothly transitioning the camera to highlight specific content.
The method automatically accounts for the camera's field of view and viewport aspect ratio to ensure the entire bounding box fits.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| boundingBoxCFrame | CFrame | The CFrame representing the center and orientation of the bounding box to fit into the viewport. | |
| boundingBoxSize | Vector3 | The Vector3 size of the bounding box to fit into the viewport. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["Basic"] |
Code samples: View on Creator Hub (Camera-ZoomToExtents).
Events
| Name | Type / Returns | Description |
|---|---|---|
| Camera.InterpolationFinished | Fired when the Camera has finished interpolating usingInterpolate(). |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.AncestryChanged | Fires when the Instance.Parent property of this object or one of its ancestors is changed. | |
| Instance.AttributeChanged | Fires whenever an attribute is changed on the Instance. | |
| Instance.ChildAdded | Fires after an object is parented to this Instance. | |
| Instance.childAdded | ||
| Instance.ChildRemoved | Fires after a child is removed from this Instance. | |
| Instance.DescendantAdded | Fires after a descendant is added to the Instance. | |
| Instance.DescendantRemoving | Fires immediately before a descendant of the Instance is removed. | |
| Instance.Destroying | Fires immediately before (or is deferred until after) the instance is destroyed via Instance:Destroy(). | |
| Instance.StyledPropertiesChanged | Fires whenever any style property is changed on the instance, including when a property is set to nil. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.Changed | Fires immediately after a property of the object changes, with some limitations. |
Camera.InterpolationFinished
Deprecated. This event has been deprecated. Instead use TweenService to smoothly animate the Camera.
This event fires when the Camera has finished interpolating using the Camera:Interpolate() method. It will not fire if a tween is interrupted due to Camera:Interpolate() being called again.
You are advised to use TweenService to animate the Camera instead, as it is more reliable and provides more options for easing styles.
| Field | Value |
|---|---|
| security | None |
| capabilities | ["Basic"] |