How do I change the FOV for a game?

Problem
So I’ve seen these sprints with this FOV effect, and wanted to the same for the players camera, but have no idea how it works, so I searched on Youtube in attempt to find my answers but was unfortunate enough to not find a solution.

So that’s why I’m turning to you guys to help find how I do this :slight_smile:

Helping me out would be much appreciated :smiley:

14 Likes
local cam = game.Workspace.Camera
local plr = game.Players.LocalPlayer
local char = plr.Character

local UserInt = game:GetService("UserInputService")

UserInt.InputBegan:Connect(function(input, gameProcessed, IsTyping)
	
	if IsTyping then return end
	if input.KeyCode == Enum.KeyCode.LeftShift then
		cam.FieldOfView = 120
                char.Humanoid.WalkSpeed = 32
	end
end)

UserInt.InputEnded:Connect(function(input, gameProcessed, IsTyping)
	
	if IsTyping then return end
	if input.KeyCode == Enum.KeyCode.LeftShift then
		cam.FieldOfView = 70
                char.Humanoid.WalkSpeed = 16
	end
end)

--place it on StarterCharacterScripts. 
--By ClanShad27
24 Likes

use only on local script because changing the camera on a local script only applies to the client

6 Likes