local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") -- Settings local MIN_FOV, MAX_FOV = 40, 120 local fov = 70 local enabled = true local dragging = false local menuDragging = false local alive = true -- Variables local connections = {} local KEYBIND_TOGGLE = Enum.KeyCode.K local KEYBIND_REMOVE = Enum.KeyCode.Delete local lastMousePos = nil local currentCamera = workspace.CurrentCamera local defaultFOV = currentCamera and currentCamera.FieldOfView or 70 -- Forward declarations local setEnabled local destroyMenu -- Connection tracking local function trackConnection(connection) table.insert(connections, connection) return connection end -- GUI local gui = Instance.new("ScreenGui") gui.Name = "FOVMenu" gui.ResetOnSpawn = false gui.Parent = playerGui local frame = Instance.new("Frame") frame.Size = UDim2.fromOffset(170, 105) frame.Position = UDim2.fromOffset(20, 100) frame.BackgroundColor3 = Color3.fromRGB(35, 35, 35) frame.BorderSizePixel = 0 frame.Active = true frame.Parent = gui local title = Instance.new("TextLabel") title.Size = UDim2.new(1, -10, 0, 18) title.Position = UDim2.fromOffset(5, 0) title.BackgroundTransparency = 1 title.Text = "FOV Controller" title.TextColor3 = Color3.new(1, 1, 1) title.TextSize = 12 title.Active = true title.Parent = frame local label = Instance.new("TextLabel") label.Size = UDim2.new(1, -10, 0, 18) label.Position = UDim2.fromOffset(5, 19) label.BackgroundTransparency = 1 label.TextColor3 = Color3.new(1, 1, 1) label.Text = "FOV: " .. fov label.TextSize = 12 label.Parent = frame -- Slider local track = Instance.new("Frame") track.Size = UDim2.new(1, -20, 0, 8) track.Position = UDim2.fromOffset(10, 43) track.BackgroundColor3 = Color3.fromRGB(85, 85, 85) track.BorderSizePixel = 0 track.Active = true track.Parent = frame local knob = Instance.new("Frame") knob.Size = UDim2.fromOffset(12, 16) knob.AnchorPoint = Vector2.new(0.5, 0.5) knob.BackgroundColor3 = Color3.fromRGB(0, 170, 255) knob.BorderSizePixel = 0 knob.Active = true knob.Parent = track -- Enable / Disable local toggle = Instance.new("TextButton") toggle.Size = UDim2.fromOffset(65, 22) toggle.Position = UDim2.fromOffset(10, 60) toggle.BackgroundColor3 = Color3.fromRGB(0, 145, 80) toggle.TextColor3 = Color3.new(1, 1, 1) toggle.TextSize = 11 toggle.Text = "ON" toggle.Parent = frame -- Remove local remove = Instance.new("TextButton") remove.Size = UDim2.fromOffset(75, 22) remove.Position = UDim2.fromOffset(85, 60) remove.BackgroundColor3 = Color3.fromRGB(170, 45, 45) remove.TextColor3 = Color3.new(1, 1, 1) remove.TextSize = 11 remove.Text = "REMOVE" remove.Parent = frame -- Keybind hint local hint = Instance.new("TextLabel") hint.Size = UDim2.new(1, -10, 0, 14) hint.Position = UDim2.fromOffset(5, 88) hint.BackgroundTransparency = 1 hint.TextColor3 = Color3.fromRGB(160, 160, 160) hint.Text = "[K] Toggle [Delete] Remove [P] Hide/Unhide" hint.TextSize = 10 hint.Parent = frame -- FOV slider local function setFOVFromX(x) local width = track.AbsoluteSize.X if width <= 0 then return end local alpha = math.clamp( (x - track.AbsolutePosition.X) / width, 0, 1 ) fov = math.floor( MIN_FOV + alpha * (MAX_FOV - MIN_FOV) + 0.5 ) knob.Position = UDim2.new(alpha, 0, 0.5, 0) label.Text = "FOV: " .. fov end local function beginSliderDrag(input) if not enabled then return end dragging = true setFOVFromX(input.Position.X) end trackConnection(track.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then beginSliderDrag(input) end end)) trackConnection(knob.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then beginSliderDrag(input) end end)) -- Drag menu using title area trackConnection(title.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then menuDragging = true lastMousePos = UserInputService:GetMouseLocation() end end)) trackConnection(UserInputService.InputChanged:Connect(function(input) if dragging and ( input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch ) then setFOVFromX(input.Position.X) end if menuDragging and ( input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch ) then local currentPos = UserInputService:GetMouseLocation() if lastMousePos then local delta = currentPos - lastMousePos frame.Position = UDim2.fromOffset( frame.AbsolutePosition.X + delta.X, frame.AbsolutePosition.Y + delta.Y ) end lastMousePos = currentPos end end)) trackConnection(UserInputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false menuDragging = false lastMousePos = nil end end)) -- Toggle local function updateToggle() toggle.Text = enabled and "ON" or "OFF" toggle.BackgroundColor3 = enabled and Color3.fromRGB(0, 145, 80) or Color3.fromRGB(90, 90, 90) end setEnabled = function(value) enabled = value updateToggle() if not enabled then local camera = workspace.CurrentCamera if camera then camera.FieldOfView = defaultFOV end end end trackConnection(toggle.Activated:Connect(function() setEnabled(not enabled) end)) -- Remove everything and clean up destroyMenu = function() if not alive then return end alive = false enabled = false RunService:UnbindFromRenderStep("FOVController") local camera = workspace.CurrentCamera if camera then camera.FieldOfView = defaultFOV end for _, connection in ipairs(connections) do connection:Disconnect() end table.clear(connections) gui:Destroy() end trackConnection(remove.Activated:Connect(destroyMenu)) -- Keybinds trackConnection(UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if UserInputService:GetFocusedTextBox() then return end if input.KeyCode == KEYBIND_TOGGLE then setEnabled(not enabled) elseif input.KeyCode == KEYBIND_REMOVE then destroyMenu() elseif input.KeyCode == Enum.KeyCode.P then frame.Visible = not frame.Visible end end)) -- Initial slider position knob.Position = UDim2.new( (fov - MIN_FOV) / (MAX_FOV - MIN_FOV), 0, 0.5, 0 ) -- Watch for FOV changes local function attachFOVWatcher(cam) return trackConnection( cam:GetPropertyChangedSignal("FieldOfView"):Connect(function() if not alive or not enabled then return end if cam.FieldOfView ~= fov then cam.FieldOfView = fov end end) ) end -- Re-attach watcher if camera changes trackConnection(workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function() local newCamera = workspace.CurrentCamera if newCamera then attachFOVWatcher(newCamera) end end)) -- Attach to initial camera local initialCamera = workspace.CurrentCamera if initialCamera then attachFOVWatcher(initialCamera) end -- Enforce FOV every frame RunService:BindToRenderStep( "FOVController", Enum.RenderPriority.Last.Value, function() if not alive or not enabled then return end local camera = workspace.CurrentCamera if camera and camera.FieldOfView ~= fov then camera.FieldOfView = fov end end ) updateToggle()