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

Why does this not work in a SurfaceGUI that changes colors of frames?

Asked by 8 years ago

This script does not work.

01while true do
02local v=script.Parent
03wait()
04local a=v.R1.BackgroundColor3
05a=Color3.random()
06wait()
07v.R2.BackgroundColor3=a
08v.R3.BackgroundColor3=a
09v.R4.BackgroundColor3=a
10end

1 answer

Log in to vote
2
Answered by 8 years ago

You can't do Color3.Random() instead you can do:

01while true do
02local v = script.Parent
03local num = math.random(0,255)
04local num2 = math.random(0,255)
05local num3 = math.random(0,255)
06wait()
07local a = v.R1
08a.BackgroundColor3 = Color3.new(num/255,num2/255,num3/255)
09 v.R2.BackgroundColor3 = a.BackgroundColor3
10v.R3.BackgroundColor3 = a.BackgroundColor3
11v.R4.BackgroundColor3 = a.BackgroundColor3
12wait()
13end
14-- You can't do .Random like BrickColor... BrickColor has an index and it select random colors from that. The proper way to do 'random' with Color3 is to use math.random... But remember if you do in fact do that. Use 1 to 0 or #/255 because they do it by a 'percent' thing as to guess. I could give a cleaner example but yeah, good luck!
Ad

Answer this question