Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i make a camera zoom out button?

Teach me how to make a camera zoom out button but i don't know how to do it. The only camera zoom out button thing i've tested is this script:

local maxZoom = game.Workspace.Camera
local CameraZoomOut = script.Parent

CameraZoomOut.MouseButton1Click:Connect(function()
      maxZoom.CFrame = CFrame.new(0,5,0)
end)

2 comments

0

Any output errors? What script type is it? Is CameraZommout a TextButton?

0

No output errors on this

1 answer

✓ Accepted answer

I'm assuming you are attempting to do this with a localscript, if not then you should be. Firstly, try finding game.Workspace.CurrentCamera instead of just Camera. Secondly, instead of altering the Camera's actual position, you can just use FieldOfView (which I believe is defaulted to 70). Just do something like...

local Camera = game.Workspace.CurrentCamera

function ResetZoom()
	Camera.FieldOfView = 70
end

CameraZoomOut.MouseButton1Click:Connect(function()
	Camera.FieldOfView = 90
end)

--Just call the ResetZoom() function when you want to put the FieldOfView back to normal

This discussion is preserved as it was. New answers, comments, and votes are closed.