Trying to tween single RGB value (I think)

As the title says, I’m trying to edit just one value of a Color3.

I’m trying to make my label smoothly change from red to orange to yellow and repeat

My idea was to set the Color3 of the label initially as (255, 0, 0), then change the G value from 0 to 255 and repeat it, to make it go through orange while tweeining to yellow.

To summarize:
I want tween to smoothly change a color3 of (255, 0, 0) to (255, 255, 0) and repeat

I’ll accept any ideas that approach this problem differently than mine.

Appreciate any help!

-- services
TS = game:GetService("TweenService")
-- variables
label = script.Parent
-- tween variables
object = label
info = TweenInfo.new(10, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1, true, 0)
ptable = {TextColor3 = Color3.new(255, 255, 0)}
-- create tween
tween = TS:Create(object, info, ptable)
-- play tween on event fired
script.Parent.Parent.FinishedLoading.Event:Connect(function()
	label.Visible = true
	label:TweenPosition(UDim2.new(0.122, 0, 0.086, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Elastic, 0.4)
	tween:Play()
end)

Just create a variable and set it as 0. Tween it to the value you want and let it act as the single green RGB value.

When Wanting to Change only one Color3 Value, You may do this:

Color3.fromRGB(12, Ex.Color.G, Ex.Color.B)
2 Likes

red to yellow in 10 seconds

for i = 0, 1.5/10, 1/4000 do
	object.TextColor3 = Color3.fromHSV(i, 0.75, 1)
	task.wait(0.01)
end

How would you tween a simple number variable? i dont think i follow

This was what I had to do all along lol
Thanks a lot for the help man I appreciate it

I just put Color3.new when I shouldve put Color3.fromRGB

Oh yeah you cant i forgor :skull: but anyways you can tween an intvalue

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.