How to get camera zoom?

Hi,
can you tell me how to get camera zoom?

5 Likes

Very Vague, but you can use tween service to tween the camera to the desired field of view.

local DesiredFOV = 35
local TweenIn = game:GetService('TweenService'):Create(workspace.CurrentCamera,TweenInfo.new(1),{FieldOfView = DesiredFOV })
local TweenOut = game:GetService('TweenService'):Create(workspace.CurrentCamera,TweenInfo.new(1),{FieldOfView = 70})

while true do
wait(1)
TweenIn:Play()
wait(1)
TweenOut:Play()
end
1 Like

Please search before you post because a simple search should be able to give you an answer to your question. On the developers hub it states this:

The Camera’s zoom is defined as the distance in studs between the Camera.CFrame and it’s Camera.Focus .

https://developer.roblox.com/en-us/api-reference/function/Camera/Zoom

Here is a simple script:

local Camera = workspace.CurrentCamera

print((Camera.CFrame.Position - Camera.Focus.Position).Magnitude)
21 Likes

I looked at it, but I overlooked it, sry

2 Likes