Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

WHAT DO I DO!? IT DOESNT CHANGE THE COLOR AND ITS DRIVING ME CRAZY

Asked by 3 years ago
01local textcolor = script.Parent.TextColor3
02 
03wait()
04while true do
05 
06    textcolor = Color3.new(255,0,0)
07    textcolor = Color3.new(0,255,0)
08    textcolor = Color3.new(0,0,255)
09    textcolor = Color3.new(255,255,0)
10    textcolor = Color3.new(0,255,255)
11 
12    wait(0.1)
13 
14end

I ALSO TRIED COLOR3.FROMRGB

2 answers

Log in to vote
1
Answered by
rabbi99 714 Moderation Voter
3 years ago

First: don't use Color3.new() if you're using 0-255 numbers.

Second: by doing textcolor = Color3.fromRGB(255,0,0), you're actually changing the value that the variable is holding. If you're willing to change a property, you have to refer to the object and then using that to change the property.

So this would be it:

01local textcolor = script.Parent
02 
03wait()
04while true do
05 
06    textcolor.TextColor3 = Color3.fromRGB(255,0,0)
07    textcolor.TextColor3 = Color3.fromRGB(0,255,0)
08    textcolor.TextColor3  = Color3.fromRGB(0,0,255)
09    textcolor.TextColor3  = Color3.fromRGB(255,255,0)
10    textcolor.TextColor3  = Color3.fromRGB(0,255,255) -- Btw, the TextColor will keep setting to this because there's not wait between changing the other colors.
11 
12    wait(0.1)
13 
14end
Ad
Log in to vote
0
Answered by 3 years ago

Pretty much everything that rabbi99 said, just a bit of change with the code.

1local textcolor = script.Parent
2 
3while true do
4    local r, g, b = math.random(0, 255), math.random(0, 255), math.random(0, 255)
5    textcolor.TextColor3 = Color3.fromRGB(r, g, b)
6 
7    wait(.1)
8end

Answer this question