We use cookies on this site to enhance your user experience

Setting Camera Zoom Distance

Setting Camera Zoom Distance

Jul 27 2018, 10:58 AM PST

​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