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

Why does this not change the colour I set it to go to?

I put a script into a gui so when you click it, the gui turns red. The problem is it instead turns white, what have I done wrong?

gui=script.Parent
function clicked()
gui.BackgroundColor3=Color3.new(255, 38, 96)
end

script.Parent.MouseButton1Click:connect(clicked)

2 answers

✓ Accepted answer

Color3 values have to be a number between 0 and 1. If you use the scale of 255, you have to divide each red, green and blue value by 255 to get it to the colour you want it.

gui=script.Parent

function clicked()
	gui.BackgroundColor3=Color3.new(255/255, 38/255, 96/255) --Dividing each red, green and blue value by 255 to get a number between 0 and 1.
end

script.Parent.MouseButton1Click:connect(clicked)

3 comments

0

What is with the down votes? It's a perfectly good answer.

0

No idea. There now at least it's not negative.

0

Thanks. I've had this for quite a few days now.

I think that color3 may be wrong, also you Can do BrickColor.new("Colorname").Color < that turns it into a color3 value.

So try BrickColor.new("Bright red").Color

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