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

Help with Color3Value? [SOLVED]

Alright so I have this script and i want the colourOn variable to be connected to a Color3Value so I can change the color through the Color3Value. Can someone help me? I know it needs to be divided by 255 on each value, But how would I do that?

colourOn = Color3.new(0, 0, 0) --Where the Color3Value should go
colourOff = Color3.new(0, 0, 0)

while true do
    c = script.Parent.LightUp:GetChildren()
    for i = 1, #c do
        if math.random() > 0.5 then
            c[i].Color = colourOn
        else
            c[i].Color = colourOff
        end
    end
    wait(0.2) 
end 

Sorry if it's a little confusing, It's hard to explain.

3 answers

You can divide it by 255 like this:

colourOn = Color3.new(0/255, 0/255, 0/255)

4 comments

0

I realize, but I need to divide the Color3Value's rgb by 255 on each value

0

Can you elaborate further? I divided the RGB values by 255 in the code I provided.

0

Alright so I have a boolian called Color3Value, and the three R G B values inside need to be divided by 255. (This is so I can control the color via other script)

0

Then just simply grab the Color3 value then divide it. It's hard to understand your situation without the code you're referencing to.

The 255 in rgb colors is the maximum amount colors everything uses. Having a number/255 just tells it how much of red, green or blue is in the color, so you can just find a rgb value and then in the script type

colourOn = Color3.new(r value here/255, g value here/255, b value here/255)

So having a value of 255/255, 0/255, 0/255 would be red

having a value of 0/255, 255/255, 0/255 would be green

having a value of 0/255, 0/255, 255/255 would be blue

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