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

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

Asked by
Ortron 27
10 years ago

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

Log in to vote
2
Answered by 10 years ago

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)
0
What is with the down votes? It's a perfectly good answer. Spongocardo 1991 — 10y
0
No idea. There now at least it's not negative. ZeptixBlade 215 — 10y
0
Thanks. I've had this for quite a few days now. Spongocardo 1991 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

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

Answer this question