|
| 15 Sep 2015 09:33 PM |
Why doesn't this work?
#code if Button.BackgroundColor3.new == Color3.new(125/255, 125/255, 125/255) then end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 15 Sep 2015 09:34 PM |
if Button.BackgroundColor3 == Color3.new(blah)
Depending on how you are setting the BackgroundColor3, this may or may not work. |
|
|
| Report Abuse |
|
|
| |
|
|
| 15 Sep 2015 09:36 PM |
It doesn't work because you but .new in front of the color your checking, not comparing.
if Button.BackgroundColor3 == Color3.new(125/255, 125/255, 125/255) then end
Hi cntkill me long time no see |
|
|
| Report Abuse |
|
|
| |
|
|
| 15 Sep 2015 09:37 PM |
And it also depends on the 'button'. If its a part its a whole different story. BackgroundColor3 is only for GUIs |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:38 PM |
| It's checking a TextButton. |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:39 PM |
Try this:
if Button.BackgroundColor3 == Color3.new(125, 125, 125) then end |
|
|
| Report Abuse |
|
|
| |
|
|
| 15 Sep 2015 09:40 PM |
| ^ You forgot to divide them by 255. |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 15 Sep 2015 09:44 PM |
Hi.
OP is there an error or is it always just 'false'? |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:44 PM |
| No error. I guess "false" you can say. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 15 Sep 2015 09:49 PM |
Try testing each component.
Did you _manually_ set the BG3 color to 125/255, ...? Or are you like using a loop which adds a bit or something? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 15 Sep 2015 10:11 PM |
| Can you print BackgroundColor3 for us? |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 10:42 PM |
| It prints "0.490196, 0.490196, 0.490196". How do we convert that to the complete color? |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 10:48 PM |
| If you try to look at the actual value in the properties panel, what does it say? Because 0.490196 * 255 = 124.99998 ~= 125. |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 10:53 PM |
Why doesn't this work?
Button.BackgroundColor3 == 0.490196 |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 10:57 PM |
Keep it simple.
if Button.BackgroundColor3 == Color3.new(.49, .49, .49) then end
Now instead of putting your color value in via studio, use a script to do it and set it to .49 so that it's an exact value. Put something like this in your command bar where Button is the variable containing your button object.
game.StarterGui.ScreenGui.Frame.Button.BackgroundColor3 = Color3.new(.49, .49, .49)
Of course, replace game.StarterGui.ScreenGui.Frame.Button with the path to your button. that was an example. After that, if you change the button color, just change it with the script! Keep your number of figures to a minimum because when you start comparing exact values (like 125/255) you can get rounding differences that will make it not perfectly equal.
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 10:58 PM |
| Print just BackgroundColor3.r. |
|
|
| Report Abuse |
|
|