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

White White White, Why?

Asked by
Vezious 310 Moderation Voter
9 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.
MainColor.BackgroundColor3 = Color3.new(math.random(255),math.random(255),math.random(255))
print(MainColor.BackgroundColor3)

The Output and The BackgroundColor3 have way different Values. WHY? D:

0
How can you be so damn stupid? Obviously the problem is that Color3.new takes 3 real numbers between 0 and 1, and math.random without a lower-limit has an implied lower-limit of 1. You're stupid. jakedies 315 — 9y

3 answers

Log in to vote
0
Answered by 9 years ago
MainColor.BackgroundColor3 = Color3.new(math.random(255)/255,math.random(255)/255,math.random(255)/255)

Color3 values are from 0 to 1. so to fix this, we will divide each one by a common denominator to make it over 1. This denominator will be 255, since 255 is the maximum Color3.

Ad
Log in to vote
0
Answered by 9 years ago

The main reason is because you're setting the colour to white (which is the color 255)

The thing you wanna do is

r = math.random(225)
g= math.random(225)
b= math.random(225)

script.Parent.BackgroundColor3=Color3.new(r/255,g/255,b/255)
Log in to vote
0
Answered by
NotSoNorm 777 Moderation Voter
9 years ago

You didn't divide!

When you start a server, rgb values become a value from 0-1, they keep it at 255 while editing so you can get more exact. You need to* divide* the value by 255 to then put it into 0-1 form

MainColor.BackgroundColor3 = Color3.new(math.random(255)/255,math.random(255)/255,math.random(255)/255)

Answer this question