How do I set the camera scroll zoom?

I’m having a problem where I want an OTS camera system, however only when a weapon is equipped, but the problem is that the player’s scroll wheel zoom isn’t being reset.

		StarterPlayer.CameraMaxZoomDistance = 10
		StarterPlayer.CameraMinZoomDistance = 10

This doesn’t seem to work, either.

Main code:

local function CameraLock(Toggle)
	if Toggle then
		StarterPlayer.EnableMouseLockOption = false

		Humanoid.AutoRotate = false
		Humanoid.CameraOffset = Vector3.new(Settings:WaitForChild("Camera"):WaitForChild("CameraX").Value, Settings:WaitForChild("Camera"):WaitForChild("CameraY").Value, Settings:WaitForChild("Camera"):WaitForChild("CameraZ").Value)
		
		ContextActionService:BindAction("Action", function() return Enum.ContextActionResult.Sink end, false, Enum.UserInputType.MouseWheel)

		RunService:BindToRenderStep("CameraLock", Enum.RenderPriority.Character.Value, function()
			UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter

			local X, Y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ()
			Character:WaitForChild("HumanoidRootPart").CFrame = CFrame.new(Character:WaitForChild("HumanoidRootPart").Position) * CFrame.Angles(0,Y,0)

		end) 
	else
		ContextActionService:UnbindAction("Action")
		UserInputService.MouseBehavior = Enum.MouseBehavior.Default
				
		Humanoid.AutoRotate = true
		Humanoid.CameraOffset = Vector3.new(0, 0, 0)
		
		StarterPlayer.EnableMouseLockOption = true
		RunService:UnbindFromRenderStep("CameraLock")
				
	end
end
1 Like