Hi, how could I tween a uigradient’s transparency? from 0 to 1 in 0.35 seconds? I’ve tried this:
local open2 = tweenservice:Create(
gradient, -- UI object you're tweening, in this case it's Frame
TweenInfo.new(0.35), -- Amount of seconds
{Transparency = 1} -- Goal
)
but it just errors.
1 Like
isoopod
(isoopod)
#2
Centaar
(Zeal)
#3
NumberSequences are not tweenable.
Centaar
(Zeal)
#4
The best way (that I can think of) to do this would be to use a NumberValue as a tween and use its Changed event.
local TweenService = game:GetService("TweenService")
local Gradient = script.Parent.UIGradient
local TValue = Instance.new("NumberValue")
TValue.Parent = Gradient
TValue.Value = Gradient.Transparency.Keypoints[1].Value
TValue.Changed:Connect(function(value)
Gradient.Transparency = NumberSequence.new(value)
end)
local tween = TweenService:Create(
TValue,
TweenInfo.new(.35),
{Value = 1}
)
tween:Play()
1 Like