Help with system creation

Hello, I’ve been wondering how I could create a system where the player’s speed will change the camera FOV so that the faster the player is, the higher the FOV (With a FOV cap of course)

Thx!

Example (Sort of)

Run

!! I AM NOT LOOKING FOR A SHIFT TO RUN WITH FOV !!

SOLVED BY DISCORD USER Mr.Sandwich#0929

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  -- The max speed your character can run at.
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)