Button with RGB text

  1. What do you want to achieve?
    I am creating a “Gui” and I put a button on it, I want the text inside the button to change color as RGB or rainbow. (just the text, not the button)

Eminem Now This Looks Like A Job For Me GIF - Eminem Now This Looks Like A Job For Me - Discover & Share GIFs

Here is a way you could do it:

local speed = 5
local button = script.Parent


while true do
	for i = 0, 255, speed do
		task.wait()
		button.TextColor3 = Color3.fromRGB(255, i, 0)
	end

	for i = 255, 0, -speed do
		task.wait()
		button.TextColor3 = Color3.fromRGB(i, 255, 0)
	end

	for i = 0, 255, speed do
		task.wait()
		button.TextColor3 = Color3.fromRGB(0, 255, i)
	end

	for i = 255, 0, -speed do
		task.wait()
		button.TextColor3 = Color3.fromRGB(0, i, 255)
	end

	for i = 0, 255, speed do
		task.wait()
		button.TextColor3 = Color3.fromRGB(i, 0, 255)
	end

	for i = 255, 0, -speed do
		task.wait()
		button.TextColor3 = Color3.fromRGB(255, 0, i)
	end
end

Not sure if its the most efficient way, but it works

EDIT: Here is a way shorter version that I somehow didnt think of before. Using HSV instead of RGB for the same effect

while true do
	for i = 1, 360 do
		script.Parent.TextColor3 = Color3.fromHSV(i / 360, 1, 1)
		task.wait()
	end
end
2 Likes

You could just lerp the color a specific amount, a lot simpler than whatever this is.

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