All my UI has a gradient on text. Here is how it looks:
While this is fine for TextScaled = true, I have some text labels with a fixed font size, that can be multiple lines. The gradient no longer looks nice on it:
Here is what I want it to look like:
I already made a script to fix this:
local label = script.Parent
local gradient = script.Parent.UIGradient
local lines = label.TextBounds.Y / label.TextSize
local keypoints = {}
for i = 1, lines do
local start = (i - 1) / lines
local startPoint = ColorSequenceKeypoint.new(start, Color3.new(1, 1, 1))
table.insert(keypoints, startPoint)
local mid = start + (1 / lines) * 0.4
local midPoint = ColorSequenceKeypoint.new(mid, Color3.new(1, 1, 1))
table.insert(keypoints, midPoint)
local finish = i / lines - 0.001
if i == lines then -- this is slightly janky but oh well
finish = 1
end
local finishPoint = ColorSequenceKeypoint.new(finish, Color3.fromRGB(65, 65, 65))
table.insert(keypoints, finishPoint)
end
gradient.Color = ColorSequence.new(keypoints)
However, exceeding 6 lines of text causes this error: ColorSequence.new(): table is too long.
What can I do about this? Ideally I dont want to make multiple text labels and split up the text, but it might be required.