How to move the camera in roblox

15 min

Beyond basic articles/customizing the camera|camera customization, you can manipulate the game camera to create specific player/character view systems, lock the camera to a world position, create unique camera effects, and more.

Camera Properties

The Roblox Camera has several built-in properties, including:

Property Description
Camera/CFrame The BasePart/CFrame|CFrame of the camera. This property is frequently used to position and move the camera in game.
Camera/Focus The point in 3D space where the camera is looking. When pointing the camera in a specific direction, you should update this property because certain visuals will be more detailed depending on how close they are to the focus point.
Camera/FieldOfView The extent of the observable game world that can be seen on screen, measured between 1–120 degrees in the vertical direction (default is 70).

Scripting the Camera

Inside scripts, the game camera can be accessed with the Workspace/CurrentCamera|CurrentCamera object:

Because each player's camera is local to their device, custom camera code should exist in a LocalScript within StarterPlayerScripts or StarterPack. Placing any of the following scripts elsewhere will not allow the code to properly take control of the camera.

A basic over-the-shoulder camera, commonly found in third-person shooter games, can be achieved with the following script. This camera stays locked behind the character’s back and players use the mouse to turn (not directional input).

Note the camera offset values on line 7 — these can be adjusted to change the camera's relative position to the character, for example to place it over the character's left shoulder (-2, 2, 8) or pull the camera further away from the player (2, 2, 15).

A simple scope in/out camera system can be implemented using the following script. This example uses the middle mouse button to zoom in and out, and the ability of ContextActionService to create a virtual zoom button on mobile devices.

The speed of the zoom in/out can be adjusted with the first argument to TweenInfo.new() on line 9 and the scope zoom power can be adjusted with the FieldOfView value on line 60 (values between 10 and 20 work best).

To rotate the camera fully or partially around a part, experiment with the following script which features adjustable camera offset, rotation time, repetition count, easing styles, and more.

The variables on lines 10–14 can be adjusted to control the script's behavior. For example, if the camera is positioned high above the target object, such as cameraOffset vector values of 0, 30, 12, setting lookAtTarget to true will make the camera tilt downward to look directly at the object.

Tags:

This Platform uses cookies to offer you a better experience, to personalize content, to provide social media features and to analyse the traffic on our site. For further information, including information on how to prevent or manage the use of cookies on this Platform, please refer to our Privacy and Cookie Policy.