PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

CameraMaxZoomDistance

Player

float

The CameraMaxZoomDistance Player property sets the maximum distance in studs the camera can be from the character with the default cameras.

In other words, it controls the maximum distance the player’s camera is allowed to zoom out.

The default value of this property is set by StarterPlayer/CameraMaxZoomDistance. If this value is set to a lower value than Player/CameraMinZoomDistance, it will be increased to CameraMinZoomDistance.


Code Samples


Setting Camera Zoom Distance

​The example demonstrates how to set a player’s camera minimum and maximum zoom distance.

In this example, we set the Player/CameraMinZoomDistance and Player/CameraMaxZoomDistance to set the min and max distance in studs a player’s camera can be from their character.

Note that since the example attempts to set the CameraMinZoomDistance to be greater than the CameraMaxZoomDistance, the CameraMinZoomDistance value will be decreased and set to the value of the max zoom distance.

To change the default min and max zoom distance values for a player when they first enter the game, you can change the StarterPlayer/CameraMinZoomDistance and StarterPlayer/CameraMaxZoomDistance properties.

local player = game.Players.LocalPlayer

player.CameraMaxZoomDistance = 50
player.CameraMinZoomDistance = 75