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 2 years ago
local textcolor = script.Parent.TextColor3

wait()
while true do

    textcolor = Color3.new(255,0,0)
    textcolor = Color3.new(0,255,0)
    textcolor = Color3.new(0,0,255)
    textcolor = Color3.new(255,255,0)
    textcolor = Color3.new(0,255,255)

    wait(0.1)

end

I ALSO TRIED COLOR3.FROMRGB

2 answers

Log in to vote
1
Answered by
rabbi99 714 Moderation Voter
2 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:

local textcolor = script.Parent

wait()
while true do

    textcolor.TextColor3 = Color3.fromRGB(255,0,0)
    textcolor.TextColor3 = Color3.fromRGB(0,255,0)
    textcolor.TextColor3  = Color3.fromRGB(0,0,255)
    textcolor.TextColor3  = Color3.fromRGB(255,255,0)
    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.

    wait(0.1)

end

Ad
Log in to vote
0
Answered by 2 years ago

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

local textcolor = script.Parent

while true do
    local r, g, b = math.random(0, 255), math.random(0, 255), math.random(0, 255)
    textcolor.TextColor3 = Color3.fromRGB(r, g, b)

    wait(.1)
end

Answer this question