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

White White White, Why?

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:

1 comment

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.

3 answers

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.

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)

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)

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