How to make smooth FOV tween script?

You are being exactly what you tried not to be.

  1. It’s too late for that comment as you can see.
  2. It’s too late for that comment as you can see.

Alright, will give it a try shortly.

You’re not being annoying. I understand that asking directly for scripts is against #scripting-support rules (well I do recall seeing a rule about it), but sometimes people are desperate and need it, so it can help them understand better. It could help them learn faster from it and not go searching everywhere with no success.

Yeah still doesn’t work thanks for the help I’ll just have to hire someone

‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎

( Post deleted by author ) ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎

Have you set the Part variable though?

Not sure what you mean, whenever I tried to edit anything I got errors.

I’m talking about this line, it specifically has a note saying to change the part variable to the part which you want to fire the function when’s it is touched…

Also if you didn’t touch that line yet, then go do it. On top of that change the line in the last message that I told you to change back to game.Workspace.CurrentCamera

Yes I renamed the part to Zume after your second edit, and changed it in the script, and then after your last edit I changed the name to ZoomPart and changed the name in the script, neither yielded any results.

You didn’t really change the part variable to “ZoomPart” string, did you? You’re supposed to reference the object that is inside the Workspace.

I clicked rename on the part inside explorer and Typed in Zume in the explorer

Could I see how your Part variable is formed? It should look like this…

local Part = whatever your thing is

I’m talking about inside of the script, an image of the instance is irrelevant. It should look like this…

local Part = whatever your thing is

You forgot to add the RemoteEvent. There’s nothing inside ReplicatedStorage… Click on ReplicatedStorage and click on the plus button, then type RemoveEvent and rename the thing that appears in ReplicatedStorage to “FOVChanger”.

Nah, the remote event was added when I actually tried it. That screenshot that I showed you above was me going back inside the game and showing you how I had it setup. I just re-pasted the script to show you.

local Part = game.Workspace.ZoomPart -- change to wanted part
local LocalPlayer = game.Players.LocalPlayer

local robloxFovLimit = {
    min = 1;
    max = 120;
    default = 70;
}

local RunService = game:GetService([[RunService]])

local function pause(n)
    local t = os.time()
    repeat RunService.RenderStepped:Wait() until os.time() - t >= n
end

local camera = game.Workspace.CurrentCamera

local fovIsChanging = false

local function smoothFov(startFov, goal, fovPerInterval, interval)
    if startFov == nil then startFov = camera.FieldOfView end
    if startFov < robloxFovLimit.min or startFov > robloxFovLimit.max or goal < robloxFovLimit.min or goal > robloxFovLimit.max or startFov - goal == 0 or fovIsChanging == true then return end
    fovIsChanging = true
    for i = startFov, goal, goal > startFov and fovPerInterval or -fovPerInterval do
        camera.FieldOfView = i
        pause(interval)
    end
    fovIsChanging = false
end

Part.Touched:Connect(function(hit)
    local Humanoid = hit.Parent:FindFirstChildOfClass([[Humanoid]])
    local Player = Humanoid and game.Players:GetPlayerFromCharacter(Humanoid.Parent)
    if Player then
        if Player == LocalPlayer then
            local startingFOV = nil -- change to nil which sets to current fov or new starting fov (from 1 to 120)
            local goalFOV = 20 -- change the rest of the variables to wanted value
            local fovPerTick = 1 -- fov changes by this number every time a cetain amount of time passes
            local fovChangeCooldown = 0.05 -- cooldown until fov ticks/changes
            
            smoothFov(startingFOV, goalFOV, fovPerTick, fovChangeCooldown)
        end
    end
end)

-- Usage example: smoothFov(camera.FieldOfView, 20, 0.3, 0.01)

Maybe you have an outdated version of the 2 scripts that I provided, so just delete the 2 I provided and replace with the above script. Remember to reference your part in the Part variable.

Oh, and, it’s a LocalScript. Place it in StarterPlayerScripts or StarterCharacterScripts.