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

Why it doens't it change to red but white?

Asked by 6 years ago

I did this but the color doenst change only to black and white?

01local playing = false
02 
03 
04local function Error()
05    if playing == false then
06    playing = true
07    local label = script.Parent
08    label.BackgroundColor3 = (Color3.new(0, 0, 0))
09    wait(0.5)
10    label.BackgroundColor3 = (Color3.new(255, 1, 5))
11    wait(0.5)
12    label.BackgroundColor3 = (Color3.new(0, 0, 0))
13    wait(0.5)
14    label.BackgroundColor3 = (Color3.new(255, 1, 5))
15    wait(0.5)
View all 23 lines...
0
Why are you wrapping Color3 in extra brackets? Unnecessary. You’re not performing math, remove them. User#19524 175 — 6y

2 answers

Log in to vote
2
Answered by 6 years ago

Color3 isn't like RGB, instead of ranging from 0-255 it ranges from 0-1.

There are 2 ways to fix this, the easier one being using Color3.fromRGB instead of Color3.new:

1Color3.fromRGB(255,1,5)

or you can divide every number by 255, so it's always a number between 0 and 1:

1Color3.new(255/255,1/255,5/255)
0
correct. User#19524 175 — 6y
2
Dividing every number by 255 is really inconvenient as well as inefficient, I’d just stick with Color3.fromRGB() . User#19524 175 — 6y
0
Okey thanks but in edit it works but in-game its like broken... MaxDev_BE 55 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Try this, if you need a different color just change the white or red to whatever the colors name is.

01local playing = false
02 
03 
04    local function Error()
05        if playing == false then
06        playing = true
07        local label = script.Parent
08        label.BrickColor = BrickColor.White()
09        wait(0.5)
10        label.BrickColor = BrickColor.Red()
11        wait(0.5)
12        label.BrickColor = BrickColor.White()
13        wait(0.5)
14        label.BrickColor = BrickColor.Red()
15        wait(0.5)
View all 23 lines...
0
That would error, because TextLabel objects don’t have a BrickColor property. User#19524 175 — 6y
1
Oh, I didnt see he was using a text label. protectiverobos -50 — 6y

Answer this question