Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with tweening Colors on textlabels ?

Hi, I looked all ovee the wiki but can't find anything, how do I tween a text label to change color smoothly and I don't want it to stop, if you can help it will help thanks.

1 answer

✓ Accepted answer

You can use TweenService to intepolate the colour of the gui from one colur to another over a given period of time.

For example:

local label = --textlabel here
local startColor = Color3.new(1,0,0)
local endColor = Color3.new(0,0,1)
local tweenTime = 1

label.BackgroundColor3 = startColor
local goal = {}
goal.BackgroundColor3 = endColor
local info = TweenInfo.new(tweenTime)
local tween = game:GetService("TweenService"):Create(label,info,goal)
while true do
	tween:Play()
	tween.Completed:Wait()
end

Or, if you wanted it to cycle through all of the colours, you could simply do something like this:

while true do
	for i = 1,255 do
		label.BackgroundColor3 = Color3.fromHSV(i/255,1,1)
		wait()
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.