RPD777
|
  |
| Joined: 31 May 2016 |
| Total Posts: 121 |
|
|
| 30 Jul 2017 10:21 AM |
I have a part which is "Pearl" in color. Therefore if I touch the part it should turn "Deep orange", but when I touch it, it turns "Cyan".
Any help would be greatly appreciated.
-------------------
script.Parent.Touched:connect(function(player) if script.Parent.BrickColor == "Pearl" then script.Parent.BrickColor = BrickColor.new("Deep orange") else script.Parent.BrickColor = BrickColor.new("Cyan") end end)
|
|
|
| Report Abuse |
|
|
|
| 30 Jul 2017 10:22 AM |
script.Parent.Touched:connect(function(player) if script.Parent.BrickColor == BrickColor.new("Pearl") then script.Parent.BrickColor = BrickColor.new("Deep orange") else script.Parent.BrickColor = BrickColor.new("Cyan") end end)
Maybe?
|
|
|
| Report Abuse |
|
|
|
| 30 Jul 2017 10:25 AM |
Ah, you can't compare a string value to a BrickColor value I guess.
I tested it out by doing this:
script.Parent.Touched:connect(function(player) if tostring(script.Parent.BrickColor) == "Pearl" then print("Hi") end end)
and that works, but if you remove tostring it does not work
|
|
|
| Report Abuse |
|
|
RPD777
|
  |
| Joined: 31 May 2016 |
| Total Posts: 121 |
|
|
| 30 Jul 2017 10:25 AM |
| Thanks for the reply, but is still doesn't work |
|
|
| Report Abuse |
|
|
RPD777
|
  |
| Joined: 31 May 2016 |
| Total Posts: 121 |
|
| |
|
LaeMVP
|
  |
| Joined: 24 Jun 2013 |
| Total Posts: 4416 |
|
|
| 30 Jul 2017 10:28 AM |
script.Parent.Touched:Connect(function(hit) script.Parent.BrickColor = script.Parent.BrickColor == BrickColor.new("Pearl") and BrickColor.new("Deep orange") or BrickColor.new("Cyan") end) |
|
|
| Report Abuse |
|
|