Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help changing FOV?

So I have script that changes the FOV on touch. The only thing I want it to do is to change the fov gradually and smoothly instead of suddenly.

enabled = true
function onTouch()
	if not enabled then
		return
	end
	wait(0.1)
game.Workspace.Camera.FieldOfView = 120
enabled = false
end 


script.Parent.Touched:connect(onTouch)  

1 answer

✓ Accepted answer
enabled = true
function onTouch()
    if not enabled then
        return
    end
    wait(0.1)
local target = 120

if game.Workspace.Camera.FieldOfView > target then
	repeat wait(.3)
		 game.Workspace.Camera.FieldOfView = game.Workspace.Camera.FieldOfView - 1
	until game.Workspace.Camera.FieldOfView = target
else
	repeat wait(.3) 
		game.Workspace.Camera.FieldOfView = game.Workspace.Camera.FieldOfView + 1
	until game.Workspace.Camera.FieldOfView = target
end

enabled = false
end 


script.Parent.Touched:connect(onTouch)  

This discussion is preserved as it was. New answers, comments, and votes are closed.