So, i’m trying to tween a property of an instance to smoothly change.
but i’m not sure what i’m doing wrong, i can’t seem to get it to work.
Some help on how to solve this issue will be very much appreciated as always
-- Variables --
local DOFEffect = game.Lighting:WaitForChild("DepthOfField")
local TweenService = game:GetService("TweenService")
local LoadTime = script.Parent.Parent.Parent.LoadTime
local Activate = script.Parent.Activate
-- Load --
wait(LoadTime.Value)
-- Function --
function ChangeDOFEffect(PropertyToModify, PropertyGoal, Tween, TweenDuration, EasingStyle)
if Tween then
local function TweenEffect()
local TI = TweenInfo.new(TweenDuration, EasingStyle, Enum.EasingDirection.In, 0) -- 5 = Duration, Style, Type, Repeat how many times
local Animation = TweenService:Create(DOFEffect, TI, {PropertyGoal = PropertyGoal})
Animation:Play()
end
TweenEffect()
else
PropertyToModify = PropertyGoal
end
end
-- Start --
repeat wait() until Activate.Value == true
ChangeDOFEffect(DOFEffect.FocusDistance, 20, true, 1, Enum.EasingStyle.Linear)
-------------