How i do zoom with right click?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make zoom with right click of mouse (this is not a tool, its a localscript)
  2. What is the issue? Include screenshots / videos if possible!
    I cant do it, when i do it, the camera acts strange.
    This is the version with no zoom:
local nameofscript = script.Name
local nameoffolderscripts = script.Parent.Name
local value = script.Parent.Parent.Parent.Values[nameofscript]

local MaxSpeed = value.MaxSpeed.Value
local AccelerationFactor = value.AccelerationFactor.Value
local DecelerationFactor = value.DecelerationFactor.Value

local player = game.Players.LocalPlayer
character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local currentSpeed = 0

local TweenService = game:GetService("TweenService")
local plusfov = 0

local Zoomed = false
while task.wait() do
	local moveDirection = humanoid.MoveDirection
	local targetSpeed = moveDirection.Magnitude * MaxSpeed

	local acceleration = (targetSpeed - currentSpeed) * AccelerationFactor
	currentSpeed = currentSpeed + acceleration

	if currentSpeed > MaxSpeed then
		currentSpeed = MaxSpeed
	elseif currentSpeed < 0 then
		currentSpeed = 0

	humanoid.WalkSpeed = currentSpeed
	local originalfov = value.FieldOfView.Value
	plusfov = humanoid.WalkSpeed / 3 

		workspace.CurrentCamera.FieldOfView = originalfov + plusfov



Hey, the best way to animate the camera would be to use TweenService | Documentation - Roblox Creator Hub for the given value :relieved:.