Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Player's CurrentCamera Zoom not changing?

Asked by 3 years ago
Edited 3 years ago

I'm currently trying to create a simple Zoom In/Out Gui just as a small practice to manipulate the player camera, in this ROBLOX API reference it says that "The Camera’s zoom is defined as the distance in studs between the Camera.CFrame and it’s Camera.Focus", so I wrote this LocalScript on a TextButton that should zoom In the players CurrentCamera:

local Camera = workspace.CurrentCamera
local ZoomDistance = (Camera.CFrame.Position - Camera.Focus.Position).Magnitude

script.Parent.MouseButton1Click:Connect(function()
    ZoomDistance = (Camera.CFrame.Position - Camera.Focus.Position).Magnitude - 20
    print("Zoomed In")
end)

Unfortunately the LocalScript does nothing with the camera zoom, it prints the "Zoomed In" message but doesn't error nor changes the zoom. I've seen people saying that to zoom In/Out you need to change the player FOV, but that's not what I'm trying to accomplish.

Am I missing something on my script or am I doing this completly wrong?

Answer this question