generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Checking a Color3 value

Previous Thread :: Next Thread 
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
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 is not online. 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
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
15 Sep 2015 09:35 PM
Yeah it didn't work?
Report Abuse
Vendicular is not online. Vendicular
Joined: 12 Apr 2013
Total Posts: 218
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
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
15 Sep 2015 09:37 PM
Yeah it didn't work?[2]
Report Abuse
Vendicular is not online. Vendicular
Joined: 12 Apr 2013
Total Posts: 218
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
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
15 Sep 2015 09:38 PM
It's checking a TextButton.
Report Abuse
Vendicular is not online. Vendicular
Joined: 12 Apr 2013
Total Posts: 218
15 Sep 2015 09:39 PM
Try this:

if Button.BackgroundColor3 == Color3.new(125, 125, 125) then
end
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
15 Sep 2015 09:40 PM
..
Report Abuse
dennis96411 is not online. dennis96411
Joined: 06 Mar 2009
Total Posts: 1079
15 Sep 2015 09:40 PM
^ You forgot to divide them by 255.
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
15 Sep 2015 09:42 PM
Nobody knows this? Dang..
Report Abuse
cntkillme is not online. 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
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
15 Sep 2015 09:44 PM
No error. I guess "false" you can say.
Report Abuse
cntkillme is not online. 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
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
15 Sep 2015 09:49 PM
Manually.
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
15 Sep 2015 09:56 PM
Give up?
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
15 Sep 2015 10:04 PM
b1
Report Abuse
dennis96411 is not online. dennis96411
Joined: 06 Mar 2009
Total Posts: 1079
15 Sep 2015 10:11 PM
Can you print BackgroundColor3 for us?
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
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
dennis96411 is not online. dennis96411
Joined: 06 Mar 2009
Total Posts: 1079
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
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
15 Sep 2015 10:53 PM
Why doesn't this work?

Button.BackgroundColor3 == 0.490196
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
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
dennis96411 is not online. dennis96411
Joined: 06 Mar 2009
Total Posts: 1079
15 Sep 2015 10:58 PM
Print just BackgroundColor3.r.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image