I was wondering if there was a way I can make my textlabel text change colors throughout the game to sort of rainbow colors.
This is not a request site Fortunately this is very easy to make, so here it is:
1 | while true do |
2 | wait( 1 ) |
3 | script.Parent.TextColor 3 = Color 3. new(math.random(),math.random(),math.random()) |
4 | wait() --Add a wait if necessary |
5 | script.Parent.TextStrokeColor 3 = Color 3. new(math.random(),math.random(),math.random()) |
6 | end |
All you have to do is put a LocalScript into your TextLabel, then paste this code into it
In addition to what T3XLAlt said, if you meant a gradient (ex a single TextLabel starting as red on the left side of the word and gradually changing to purple on the right side -- a rainbow), you cannot easily do this, as Roblox does not support gradients at this time. The easiest approximation is to make each letter a different colour.
Technically, you could create a gradient by having the same TextLabel in the same spot numerous times, making each one a slightly different colour. Each one would be parented to a different Frame that would have ClipsDescendents = true and would only let the user see a 1 pixel strip of the TextLabel. However, this would be expensive to create and update, and there's a limit to how many gui objects you can put on the screen before Roblox starts to lag (though I'm sure this depends on the computer).
1 | function zigzag(X) return math.acos(math.cos(X*math.pi))/math.pi end |
2 |
3 | counter = 0 |
4 |
5 | while wait( 0.1 ) do |
6 | script.Parent.TextStrokeColor 3 = Color 3. fromHSV(zigzag(counter), 1 , 1 ) |
7 |
8 | counter = counter + 0.01 |
9 | end |
Here is the way i make mine today in 2019 :D Hope it works