I’m searching this everywhere, how to make a script that makes the camera FOV change depending on the moving speed of the camera and then change the FOV back to normal?
I’m a bad scripter so i search for support, and still don’t know how to start with the script…
So if you flick your camera, the FOV changes to very high.
I need help.
If you barely understand this, than it may be because of my english, i’m a balkan so it’s not my first language.
local tweens = game:GetService("TweenService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local camera = workspace.CurrentCamera
local minSpeed = 0
local maxSpeed = 16
local minFov = 70
local maxFov = 90
humanoid.Running:Connect(function(speed)
local ratio = (maxFov - minFov) / (maxSpeed - minSpeed)
local fov = minFov + (speed * ratio)
local tween = tweens:Create(camera, TweenInfo.new(0.2, Enum.EasingStyle.Linear), {FieldOfView = fov})
tween:Play()
end)
Local script inside StarterCharacterScripts folder.
local minSpeed = 0
local maxSpeed = 16
local minFov = 70
local maxFov = 90
Change these four variables to change the script’s behavior.
This is bussin’ but i think you didn’t understand something,
what i meant is:
If i move my camera with my mouse fast, the FOV changes and if the camera is still, the FOV changes back to normal.
The camera’s CFrame is always going to be moving (at least as long as the client’s character model is moving).
You could use a “RenderStepped” event loop to determine how much the camera has moved between frames & act accordingly (increase/decrease the camera’s field of view).