Tweening color changes smoothly?

How would I tween the color changing of a TextColor? I tried already but it errored because tween service only supports int values.

1 Like

You could try either a while loop, or gradients. Don’t know how to set up gradients, but its possible from what I know.

You can tween the R, the G, and the B at the same time.

I wouldnt use TweenService for that, you could use a loop to make it better. There are tons of posts on it tho.

I’d recommend lerping.

local Tick = tick

local function TweenColor(Object, Property, Duration, StartColor, EndColor)
	local StartTime = Tick()
	repeat
		local CurrentTime = Tick()
		Object[Property] = StartColor:Lerp(EndColor, (CurrentTime - StartTime) / Duration)
	until (CurrentTime - StartTime) > Duration 
end

TweenColor(TextLabel, "TextColor3", 2, Color3.new(1, 0, 0), Color3.new(0, 1, 0)) --Example use of function.
2 Likes