Hello!
I made an ADS (Aim down the sights) system.
And I wanna make a camera zoom, not like just changing the field of view, I wanna make it smooth zooming.
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
0.2, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will not reverse once reaching it's goal)
0 -- DelayTime
)
local tween = TweenService:Create(cam, tweenInfo, { FieldOfView = 70 - (module.ADS_RANGE * 2) })
tween:Play()
If you check TweenService’s wiki page you can see that it requires 3 arguments to create the tween Instance, TweenInfo and PropertyTable.
PropertyTable argument is actually a table that has the things to do, for this example if you set { FieldOfView = 1 } it will move the Camera’s FieldOfView to 1 smoothly.