After the notice of the deprecation of the legacy text service was put up, I had (successfully) ported it over to the newer version. However, I wanted to apply some animated gradients to chat tags. The gradient “works” but only if you repeatedly hover and unhover over the chat box.
As the title suggests, is there any way to repeatedly update so that I can get the smooth gradient that I want?
(Assume the gradient has already been placed in the window properties)
Code below:
--// UIGradient Animation
local Gradients: {[number]: UIGradient} = {}
local alpha = 0
local bufferTime = 3
local btElapsed = 0
local bufferEnabled = false
runService.RenderStepped:Connect(function(dt)
if #Gradients == 0 then
alpha = 0
btElapsed = 0
bufferEnabled = false
return
end
if bufferEnabled then
alpha = 0
btElapsed += dt
if btElapsed >= bufferTime then
btElapsed = 0
bufferEnabled = false
else
print("Buffer is enabled!")
return
end
end
local index = 1
btElapsed = 0
alpha += dt
print(alpha)
repeat
local Gradient = Gradients[index]
if Gradient.Parent == nil then
Gradient:Destroy()
table.remove(Gradients,index)
continue
end
Gradient.Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(255,255,255)),
ColorSequenceKeypoint.new(math.min(math.max(alpha - .2, 0),1), Color3.fromRGB(255,255,255)),
ColorSequenceKeypoint.new(math.min(alpha, 1), Color3.fromRGB(255, 255, 0)),
ColorSequenceKeypoint.new(math.min(alpha + .2, 1), Color3.fromRGB(255,255,255)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(255,255,255)),
}
)
index += 1
until index > #Gradients
if alpha >= 1.5 then
alpha = 0
bufferEnabled = true
btElapsed = 0
end
end)
Video of it “working”: