When scrolling with your mouse during this, it just kills you. Why? I don’t know.
local inputserv = game:GetService("UserInputService")
local mouse = game.Players.LocalPlayer:GetMouse()
zoomstat = 50
zoomoutlimit = 1200
zoomsmallest = 10
local runserv = game:GetService("RunService")
runserv.RenderStepped:Connect(function()
if workspace.CurrentCamera.CameraType ~= Enum.CameraType.Scriptable then
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
end
if workspace.CurrentCamera.CameraType == Enum.CameraType.Scriptable then
if game.Players.LocalPlayer.Character ~= nil then
local zs = game.Players.LocalPlayer.Character:FindFirstChild("Head")
if zs ~= nil then
workspace.CurrentCamera.CFrame = CFrame.lookAt(game.Players.LocalPlayer.Character.Head.Position + Vector3.new(0,tonumber(zoomstat),0), game.Players.LocalPlayer.Character.Head.Position)
end
end
end
end)
--inputserv.InputBegan:Connect(function(input,gamepr)
-- if input.UserInputType == Enum.UserInputType.MouseWheel then
-- end
--end)
inputserv.InputChanged:connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseWheel then
local the = input.Position.Z > 0 and "UP" or "DOWN"
if the == "UP" then
if (zoomstat + 1) >= zoomoutlimit then
zoomstat = tonumber(zoomoutlimit)
else
zoomstat = tonumber((zoomstat + 1))
end
end
if the == "DOWN" then
if (zoomstat - 1) <= zoomsmallest then
zoomstat = tonumber(zoomsmallest)
else
zoomstat = tonumber(zoomstat - 1)
end
end
end
end)
--mouse.WheelBackward:Connect(function()
-- if (zoomstat + 25) >= zoomoutlimit then
-- zoomstat = zoomoutlimit
-- else
-- zoomstat = zoomstat + 25
-- end
--end)
--mouse.WheelForward:Connect(function()
-- if (zoomstat - 25) <= zoomsmallest then
-- zoomstat = 10
-- else
-- zoomstat = zoomstat - 25
-- end
--end)