How to make ui visible slowly using ui gradient

To the point, so i need a script that make ui slowly appears with ui gradient transparency. i tried using NumberSequence() but i cant get it to work

I think these sequences should work, try to tween between them.

local startSequence ={, 1),, 1)
local middleSequence ={, 1),, 1)
local endSequence ={, 0),, 1)

can you make it using tweenservice ?

You want me to make it or asking if it’s possible?

yea if its possible to do that?

I don’t think it’s possible to tween sequences so I’ll see what I can do.

1 Like

Thinking about it, you can just do it using the BackgroundTransparency property…

oh yea, now you mention it. thx

I thought you needed to make it like appear sideways and not all in the same time if that makes sense, I’ll write a quick code and send it.

TweenService:Create property named 'Transparency' on object 'UIGradient' is not a data type that can be tweened

i got this error

local tweenService = game:GetService("TweenService")

local tweenInfo =
	1, -- time
	Enum.EasingStyle.Sine, -- easing style
	Enum.EasingDirection.Out, -- easing direction
	0, -- reverse
	false, -- repeat count
	0 -- delay between repeats

local frame -- path to your frame

local function show()
	local tween = tweenService:Create(frame, tweenInfo, {BackgroundTransparency = 0})
	tween.Completed:Wait() -- optional

local function hide()
	local tween = tweenService:Create(frame, tweenInfo, {BackgroundTransparency = 1})
	tween.Completed:Wait() -- optional

yea ik that, but i need a gradient

1 Like

Ya well, you can’t tween NumberSequences, you can try lerping the value of “position” and the transparency from 1 to 0 .

hmmm well thats unfortunate to hear

I’ll just write you some code.

Here you go, don’t forget to call the function when needed.

local iterations = 100 -- change 100 to increase/decrease smoothness

local uiGradient: UIGradient

local function lerp(v0, v1, t)
	return (1 - t) * v0 + t * v1

local function getShowSequence(t: number, keypoint2: NumberSequenceKeypoint): NumberSequence
	return{, 1, t), lerp(1, 0, t)),

local function getHideSequence(t: number, keypoint2: NumberSequenceKeypoint): NumberSequence
	return{, 0, t), lerp(0, 1, t)),

local function handle(show: boolean)
	local keypoint1 =, 1)
	local keypoint2 =, 1)
		for i = 1, iterations do
			uiGradient.Transparency = (show and getShowSequence or getHideSequence)(i / iterations, keypoint12)
1 Like