roblox disable camera zoom code example
Example: how to disable camera zooming in roblox
local player = game.Players.LocalPlayer
local currentZoom = (workspace.CurrentCamera.CoordinateFrame.p - player.Character.Head.Position).magnitude (calc. currentzoom)
local LastMaxZoom = player.CameraMaxZoomDistance
local LastMinZoom = player.CameraMinZoomDistance
local isDisabled = false
function ToggleScroll()
if isDisabled then
isDisabled = false
player.CameraMaxZoomDistance = LastMaxZoom
player.CameraMinZoomDistance = LastMinZoom
else
isDisabled = true
player.CameraMaxZoomDistance = currentZoom
player.CameraMinZoomDistance = currentZoom
end
end