Hi,
I have this script and I want it to change the colour of the button on the Surface Gui when clicked. Everything else works apart from the colour changing.
Please help!
This is the script;
LP = script.Parent.Parent.Parent.Parent.Parent.Parent.SpotLight1.Light.SpotLight function Click(mouse) if LP.Enabled == true then LP.Enabled = false script.Parent.BackgroundColor3 = BackgroundColor3.new("163, 162, 165") else LP.Enabled = true script.Parent.BackgroundColor3 = BackgroundColor3.new("165, 0, 0") end end script.Parent.MouseButton1Down:connect(Click)
Any more questions just ask
Thanks Kieran
When we look on the Wiki for BackgroundColor3 we'll see that it's a Color3 (not a "BackgroundColor3").
From that article, we see the constructor - the function to make new values - is Color3.new(Number r, Number g, Number b)
. (r
is "red", g
is "green", and b
is "blue" in the RGB color model)
Please keep in mind that Color.new
's parameters range between 0 and 1 instead of values ranging between 0 and 255 as it is shown in the Properties tab.
For example, web color Gold is RGB (255, 215, 0); to make this color, we would use Color3.new(255/255, 215/255, 0)
or Color3.new(1, 0.843,0)
.