|
| 07 Jul 2014 12:33 AM |
local part=Workspace.Color function onTouch(Color) script.Parent.BrickColor = BrickColor.new(math.random()) end part.Touched:connect(onTouch)
Just noticed a bug or something. It only randomizes two colours (grey and white) Pardon me if its obvious or something I haven't used Lua in 4 years. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2014 12:34 AM |
| Hopefully my scripting isn't too rusty to the point where this is just a obvious mistake. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2014 12:34 AM |
if you want a random color, do
BrickColor.random()
instead. Colors have a number value, so it makes sense that the numbers within (0-1) are either white or grey. |
|
|
| Report Abuse |
|
|
| |
|
blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
|
| 07 Jul 2014 02:13 AM |
If you want to use your original code, but have random colors, try this:
==
local part=Workspace.Color function onTouch(Color) script.Parent.BrickColor = BrickColor.new(math.random(), math.random(), math.random()) end part.Touched:connect(onTouch)
==
System32? Delete it. |
|
|
| Report Abuse |
|
|
blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
|
| 07 Jul 2014 02:14 AM |
You have to iterate the math.random a couple of times.
System32? Delete it. |
|
|
| Report Abuse |
|
|