Hello, developers! I am making a text animation for my scoreboard like Hypixel’s.
It basically goes through all the letters one by one and changes them to a darker shade of yellow.
My problem is that the text is skipping the last letter because it searches for the letter from the start of the string. (I am using string.gsub) It looks like this.
string.gsub(String, Letter, NewLetter, 1)
“THE PIT”
“THE PIT”
Whenever I remove the third argument, it just makes both letters a dark shade of yellow.
string.gsub(String, Letter, NewLetter)
“THE PIT”
Code:
Code
local TextLabel = script.Parent
local String = TextLabel.Text
local ColorCode = "<font color='rgb(195, 207, 17)'>letter</font>"
while true do
for i = 1, #String do
local Letter = string.sub(String, i, i)
local NewLetter = string.gsub(ColorCode, "letter", Letter, 1)
local NewString = string.gsub(String, Letter, NewLetter, 1)
TextLabel.Text = NewString
task.wait(0.2)
end
end
I understand why its skipping, I am just asking for a possible solution to this problem.
Thank you!
So I have a little problem. It removes my text shadow. However, I created a flashing animation to go with the other animation, and the text shadow reappears. I’m guessing its because the first animation covered the text shadow. I can even see the text moving a bit when it changes. Do you know why?