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

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

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

1 comment

0

Why are you wrapping Color3 in extra brackets? Unnecessary. You’re not performing math, remove them.

2 answers

✓ Accepted answer

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)

3 comments

0

correct.

2

Dividing every number by 255 is really inconvenient as well as inefficient, I’d just stick with Color3.fromRGB() .

0

Okey thanks but in edit it works but in-game its like broken...

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

2 comments

0

That would error, because TextLabel objects don’t have a BrickColor property.

1

Oh, I didnt see he was using a text label.

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