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 3 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.
local 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)}

local function generate()
    return Colors[math.random(1, #Colors)]
end

while true do
    for i, v in pairs(script.Parent:GetDescendants()) do
        if v:IsA("Part") then
            local c = generate()
            v.Color = c
            print(c)
            v.Transparency = 0
            v.Material = "Neon"
        end
    end
    wait(1)
end

Please help, thanks!

0
You could try putting the color values normally, without the divide operation shadow2008_br 176 — 3y
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 — 3y

1 answer

Log in to vote
0
Answered by 3 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 — 3y
Ad

Answer this question