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

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

  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!

2 comments

0

You could try putting the color values normally, without the divide operation

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?

1 answer

Fixed. Thanks! (Due to color correction)

1 comment

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!

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