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 5 years ago

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

local playing = false


local function Error()
    if playing == false then
    playing = true
    local label = script.Parent
    label.BackgroundColor3 = (Color3.new(0, 0, 0))
    wait(0.5)
    label.BackgroundColor3 = (Color3.new(255, 1, 5))
    wait(0.5)
    label.BackgroundColor3 = (Color3.new(0, 0, 0))
    wait(0.5)
    label.BackgroundColor3 = (Color3.new(255, 1, 5))
    wait(0.5)
    label.BackgroundColor3 = (Color3.new(0, 0, 0))
    wait(0.5)
    label.BackgroundColor3 = (Color3.new(255, 1, 5))
    wait(0.5)
    label.BackgroundColor3 = (Color3.new(0, 0, 0))
    playing = false
    end
end
0
Why are you wrapping Color3 in extra brackets? Unnecessary. You’re not performing math, remove them. User#19524 175 — 5y

2 answers

Log in to vote
2
Answered by 5 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:

Color3.fromRGB(255,1,5)

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

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

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

local playing = false


    local function Error()
        if playing == false then
        playing = true
        local label = script.Parent
        label.BrickColor = BrickColor.White()
        wait(0.5)
        label.BrickColor = BrickColor.Red()
        wait(0.5)
        label.BrickColor = BrickColor.White()
        wait(0.5)
        label.BrickColor = BrickColor.Red()
        wait(0.5)
        label.BrickColor = BrickColor.White()()
        wait(0.5)
        label.BrickColor = BrickColor.Red()
        wait(0.5)
        label.BrickColor = BrickColor.White()
        playing = false
        end
    end
0
That would error, because TextLabel objects don’t have a BrickColor property. User#19524 175 — 5y
1
Oh, I didnt see he was using a text label. protectiverobos -50 — 5y

Answer this question