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

subtracting r,g,b from a textlabels text?

I have this but it is always giving me an error on the textcolor.r = textcolor.r +1 part how do i fix?

local speed = .5
local this = script.Parent
local textcolor = this.TextColor3
local color1 = Color3.new(255,0,0)
local color2 = Color3.new(0,0,255)


repeat
	
	textcolor.r = textcolor.r +1
	textcolor.b = textcolor.b -1

	wait(speed)	

until this.TextColor3 == color1

2 comments

0

What's the error?

0

RColour = RColour + (1/255)?

1 answer

The r,g, and b values of a Color3 are read-only, meaning that attempting to assign to assign a value to it will return an error.

Also, Color3.new's values are supposed to be between 0 and 1.

local speed = 5
local this = script.Parent
local textcolour = this.TextColor3
local colour1 = Color3.new(1,0,0)
local colour2 = Color3.new(0,0,1)

local r = textcolor.r
local b = textcolor.b

repeat
	r = r + 1
	b = b - 1
	this.TextColor3 = Color.new(r/255,0,b/255)
	wait(speed)
until this.TextColor3 == colour1

1 comment

0

this doesnt work either

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