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

Help with Color3Value? [SOLVED]

Asked by
NotSoNorm 777 Moderation Voter
10 years ago

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

Log in to vote
0
Answered by
Sparker22 190
10 years ago

You can divide it by 255 like this:

colourOn = Color3.new(0/255, 0/255, 0/255)
0
I realize, but I need to divide the Color3Value's rgb by 255 on each value NotSoNorm 777 — 10y
0
Can you elaborate further? I divided the RGB values by 255 in the code I provided. Sparker22 190 — 10y
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) NotSoNorm 777 — 10y
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. Sparker22 190 — 10y
Ad
Log in to vote
0
Answered by
NotSoNorm 777 Moderation Voter
10 years ago

Never mind guys I figured it out

Log in to vote
-1
Answered by 10 years ago

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

Answer this question