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

Why is it returning black as a color when it is not in the color table?

Asked by 4 years ago
  1. I want the script to randomly choose a color from the color table.
  2. The color, black, returns even though it's not in the table.
  3. Used a function, tried Color3.fromRGB, etc.
01local Colors = {Color3.new(255/255, 0/255, 0/255), Color3.new(255/255, 110/255, 0/255), Color3.new(255/255, 255/255, 0/255), Color3.new(0/255, 255/255, 0/255), Color3.new(0/255, 156/255, 255/255), Color3.new(200/255, 0/255, 255/255), Color3.new(255/255, 50/255, 255/255)}
02 
03local function generate()
04    return Colors[math.random(1, #Colors)]
05end
06 
07while true do
08    for i, v in pairs(script.Parent:GetDescendants()) do
09        if v:IsA("Part") then
10            local c = generate()
11            v.Color = c
12            print(c)
13            v.Transparency = 0
14            v.Material = "Neon"
15        end
16    end
17    wait(1)
18end

Please help, thanks!

0
You could try putting the color values normally, without the divide operation shadow2008_br 176 — 4y
0
He would then have to use .fromrgb instead of .new, shouldn't make a difference (Which he already tried) Is it always the color black? Any errors? greatneil80 2647 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Fixed. Thanks! (Due to color correction)

0
Well done on fixing it! Make sure you add (Answered) at the start or end of the title to let people know that you have found the fix! RazzyPlayz 497 — 4y
Ad

Answer this question