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

CameraMinZoomDistance

Player

float

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

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

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


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