georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
|
| 11 Nov 2014 07:42 PM |
while true do wait() if script.Parent.BackgroundColor3 == Color3.new(196, 40, 28) then script.Parent.Parent.ShieldValue = "Bright red" elseif script.Parent.BackgroundColor3 == Color3.new(164, 189, 71) then script.Parent.Parent.ShieldValue = "Camo" elseif script.Parent.BackgroundColor3 == Color3.new(218, 133, 65) then script.Parent.Parent.ShieldValue = "Deep orange" elseif script.Parent.BackgroundColor3 == Color3.new(245, 205, 48) then script.Parent.Parent.ShieldValue = "Bright Yellow" elseif script.Parent.BackgroundColor3 == Color3.new(107, 50, 124) then script.Parent.Parent.ShieldValue = "Bright violet" elseif script.Parent.BackgroundColor3 == Color3.new(204, 142, 105) then script.Parent.Parent.ShieldValue = "Nougat" end end
This doesn't seem to work. The shield value is a brick color value. |
|
|
| Report Abuse |
|
|
Oskee
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 297 |
|
|
| 11 Nov 2014 07:47 PM |
script.Parent.Parent.ShieldValue = "Bright yellow"
u caps yellow |
|
|
| Report Abuse |
|
|
LizardCar
|
  |
| Joined: 06 Dec 2010 |
| Total Posts: 36 |
|
|
| 11 Nov 2014 07:58 PM |
I don't think you can compare .BackgroundColor3 with Color3.new(v,v,v), also, the Color3.new accepts numbers from 0 to 1 (Color3.new(204/255,142/255,105/255), or Color3.new(0.8,0.56,0.41)).
Maybe you might need to reformat the script using BrickColor.Name (http://wiki.roblox.com/index.php?title=BrickColor)
Such as
if script.Parent.BackgroundColor3.Name=="Bright red" then script.Parent.Parent.ShieldValue = "Bright red" ---and so forth end
I'm not sure though. I just read this right now. I'm testing it and it seems to work for me.
|
|
|
| Report Abuse |
|
|
LizardCar
|
  |
| Joined: 06 Dec 2010 |
| Total Posts: 36 |
|
|
| 11 Nov 2014 08:09 PM |
| Sorry I thought script.Parent.BackgroundColor3 was from a Part Instance. |
|
|
| Report Abuse |
|
|
Vescatur
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 3426 |
|
|
| 11 Nov 2014 08:48 PM |
Is ShieldValue a color value, or a string value?
if either, it should be:
script.Parent.Parent.ShieldValue.Value = 'Whatever' |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 11 Nov 2014 08:57 PM |
| OP, You can't compare color values like that. |
|
|
| Report Abuse |
|
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
|
| 11 Nov 2014 09:33 PM |
Here is the updated script: Still doesn't work.
while true do wait() if script.Parent.BackgroundColor3 == Color3.new(196, 40, 28) then script.Parent.Parent.ShieldValue.Value = "Bright red" elseif script.Parent.BackgroundColor3 == Color3.new(164, 189, 71) then script.Parent.Parent.ShieldValue.Value = "Camo" elseif script.Parent.BackgroundColor3 == Color3.new(218, 133, 65) then script.Parent.Parent.ShieldValue.Value = "Deep orange" elseif script.Parent.BackgroundColor3 == Color3.new(245, 205, 48) then script.Parent.Parent.ShieldValue.Value = "Bright yellow" elseif script.Parent.BackgroundColor3 == Color3.new(107, 50, 124) then script.Parent.Parent.ShieldValue.Value = "Bright violet" elseif script.Parent.BackgroundColor3 == Color3.new(204, 142, 105) then script.Parent.Parent.ShieldValue.Value = "Nougat" end end
|
|
|
| Report Abuse |
|
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
| |
|
LizardCar
|
  |
| Joined: 06 Dec 2010 |
| Total Posts: 36 |
|
|
| 11 Nov 2014 11:56 PM |
I used the == operator to compare 2 Color3 objects, and it seem to work. They never mentioned it in http://wiki.roblox.com/index.php/Color3 :(. But I think they mentioned in http://wiki.roblox.com/index.php?title=BrickColor (Comparing BrickColors) that you can compare their Color3 values to see if they're equal.
Try this:
if script.Parent.BackgroundColor3 == BrickColor.new("Bright red").Color then --Compare the Color3 object with Color3 object of BrickColor if equal. script.Parent.Parent.ShieldValue.Value = "Bright red" elseif script.Parent.BackgroundColor3 == BrickColor.new("Camo").Color then script.Parent.Parent.ShieldValue.Value = "Camo" --And so forth. end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 12 Nov 2014 12:36 AM |
| Yeah you can probably compare it, but if the Color3 was added to, and not changed, it's not going to work as expected. |
|
|
| Report Abuse |
|
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
|
| 12 Nov 2014 09:39 AM |
Updated Script: Still doesn't work
while true do wait() if script.Parent.BackgroundColor3 == BrickColor.new("Bright red").Color then --Compare the Color3 object with Color3 object of BrickColor if equal. script.Parent.Parent.ShieldValue.Value = "Bright red" elseif script.Parent.BackgroundColor3 == BrickColor.new("Camo").Color then script.Parent.Parent.ShieldValue.Value = "Camo" if script.Parent.BackgroundColor3 == BrickColor.new("Deep Orange").Color then --Compare the Color3 object with Color3 object of BrickColor if equal. script.Parent.Parent.ShieldValue.Value = "Deep Orange" elseif script.Parent.BackgroundColor3 == BrickColor.new("Camo").Color then script.Parent.Parent.ShieldValue.Value = "Camo" if script.Parent.BackgroundColor3 == BrickColor.new("Bright yellow").Color then --Compare the Color3 object with Color3 object of BrickColor if equal. script.Parent.Parent.ShieldValue.Value = "Bright yellow" elseif script.Parent.BackgroundColor3 == BrickColor.new("Bright violet").Color then script.Parent.Parent.ShieldValue.Value = "Bright violet" if script.Parent.BackgroundColor3 == BrickColor.new("Nougat").Color then --Compare the Color3 object with Color3 object of BrickColor if equal. script.Parent.Parent.ShieldValue.Value = "Nougat" elseif script.Parent.BackgroundColor3 == BrickColor.new("Br. yellowish green").Color then script.Parent.Parent.ShieldValue.Value = "Br. yellowish green" end end
|
|
|
| Report Abuse |
|
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
| |
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
| |
|
|
| 13 Nov 2014 07:22 PM |
Hai george.
I see your problem, most likely.
If the value is a Brickcolor Value, I think you should do this:
value.Value = BrickColor.new("Color")
|
|
|
| Report Abuse |
|
|
|
| 13 Nov 2014 07:26 PM |
| How does a thread containing two frequent scripters and at least three others not point out the problem of creating a Color3 with values greater than 1? |
|
|
| Report Abuse |
|
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
|
| 14 Nov 2014 12:08 AM |
@Hyroad Still Doesn't Seem to Work. Oh, and Hai. =)
UPDATED CODE:
while true do wait() if script.Parent.BackgroundColor3 == BrickColor.new("Bright red").Color then --Compare the Color3 object with Color3 object of BrickColor if equal. script.Parent.Parent.ShieldValue.Value = BrickColor.new("Bright red") elseif script.Parent.BackgroundColor3 == BrickColor.new("Camo").Color then script.Parent.Parent.ShieldValue.Value = "Camo" if script.Parent.BackgroundColor3 == BrickColor.new("Deep orange").Color then --Compare the Color3 object with Color3 object of BrickColor if equal. script.Parent.Parent.ShieldValue.Value = BrickColor.new("Deep orange") elseif script.Parent.BackgroundColor3 == BrickColor.new("Camo").Color then script.Parent.Parent.ShieldValue.Value = BrickColor.new("Camo") if script.Parent.BackgroundColor3 == BrickColor.new("Bright yellow").Color then --Compare the Color3 object with Color3 object of BrickColor if equal. script.Parent.Parent.ShieldValue.Value = BrickColor.new("Bright yellow") elseif script.Parent.BackgroundColor3 == BrickColor.new("Bright violet").Color then script.Parent.Parent.ShieldValue.Value = BrickColor.new("Bright violet") if script.Parent.BackgroundColor3 == BrickColor.new("Nougat").Color then --Compare the Color3 object with Color3 object of BrickColor if equal. script.Parent.Parent.ShieldValue.Value = BrickColor.new("Nougat") elseif script.Parent.BackgroundColor3 == BrickColor.new("Br. yellowish green").Color then script.Parent.Parent.ShieldValue.Value = BrickColor.new("Br. yellowish green") end end
|
|
|
| Report Abuse |
|
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
| |
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 16 Nov 2014 12:42 PM |
You probably don't want to do division in comparison with two color3s because floating point precision will probably throw you off.
if BrickColor.new(script.Parent.BackgroundColor3) == BrickColor.new("Bright red") then
Try that, that should round "script.Parent.BackgroundColor3" to the nearest color value available with BrickColor, just in case your BackgroundColor3 value wasn't exact or something. |
|
|
| Report Abuse |
|
|
georgeba
|
  |
| Joined: 29 Oct 2011 |
| Total Posts: 1092 |
|
| |
|