How to disable zooming for Player?

Hi guys! :slight_smile:

How can I make a script which is disable to the player the zooming.
I tried with this solution:

--//ZOOM\\--

game.StarterPlayer.CameraMaxZoomDistance = 8

And I have a Third Person Camera:

--Created by: ImFarley 

--//THIRD PERSON SHOOTER CAMERA SCRIPT\\--

local uis = game:GetService("UserInputService")
local ts = game:GetService("TweenService")
local cam = workspace.CurrentCamera
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
repeat wait() until plr.Character and plr.Character.Parent == workspace

local char = plr.Character
local hum = char:WaitForChild("Humanoid")
local waist = char.UpperTorso:WaitForChild("Waist")
local root = char:WaitForChild("HumanoidRootPart")

hum.CameraOffset = Vector3.new(3, 0, 0)
hum.AutoRotate = false
cam.CameraSubject = hum

game:GetService("RunService").RenderStepped:Connect(function()
uis.MouseBehavior = Enum.MouseBehavior.LockCenter
local delta = uis:GetMouseDelta()
local deltaX, deltaY = delta.X, -delta.Y
cam.CFrame = CFrame.new(cam.CFrame.p, cam.CFrame* CFrame.new(deltaX, deltaY, -2000).p)

local offset = char.LowerTorso.CFrame:ToWorldSpace(CFrame.new(0, char.UpperTorso.Size.Y/2, 0)) * CFrame.fromEulerAnglesXYZ(math.max(math.min(math.asin((mouse.Hit.p - mouse.Origin.p).unit.y), .6), -.75), 0, 0) * CFrame.new(0, char.UpperTorso.Size.Y/2, 0)

waist.C1 = offset:inverse() * char.LowerTorso.CFrame * CFrame.new(0, .8, 0)

local tweenInfo = TweenInfo.new(.15, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
local newRootCF = CFrame.new(root.CFrame.p,root.CFrame.p+Vector3.new(cam.CFrame.lookVector.X,0,cam.CFrame.lookVector.Z))
local tween = ts:Create(root, tweenInfo, {["CFrame"] = newRootCF}, true)
tween:Play()
end)

5 Likes

you can just change this things right here:

9 Likes

and you can just set the max to the min zoom.

2 Likes