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

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

This script does not work.

while true do
local v=script.Parent
wait()
local a=v.R1.BackgroundColor3
a=Color3.random()
wait()
v.R2.BackgroundColor3=a
v.R3.BackgroundColor3=a
v.R4.BackgroundColor3=a
end

1 answer

✓ Accepted answer

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

while true do
local v = script.Parent
local num = math.random(0,255)
local num2 = math.random(0,255)
local num3 = math.random(0,255)
wait()
local a = v.R1
a.BackgroundColor3 = Color3.new(num/255,num2/255,num3/255)
 v.R2.BackgroundColor3 = a.BackgroundColor3
v.R3.BackgroundColor3 = a.BackgroundColor3
v.R4.BackgroundColor3 = a.BackgroundColor3
wait()
end
-- 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! 

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