Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What went wrong here?

Asked by
sebsa 0
9 years ago

I'm trying to make this script in which your scroll up, the FieldOfView will increase until it hits 50. However, when I run the script it goes farther than 50 all the way to 1. Any reason why this is happening?

local Player = game.Players.LocalPlayer
local Camera = game.Workspace.CurrentCamera
local debounce = false
local Min = 50
local Max = 70
local Mouse = Player:GetMouse ()


Mouse.WheelForward:connect (function()

if debounce == true then return end
debounce = true

if Camera.FieldOfView == Max then
    while Camera.FieldOfView ~= Min do
        Camera.FieldOfView = Camera.FieldOfView - .5
        wait ()
    end
end

wait ()

debounce = false
end)

Answer this question