|
| 27 Dec 2013 12:04 PM |
tc[i].BrickColor = BrickColor.new(math.random(#Colors)) end end
I'm trying to call for the table "Colors" and it's pulling random colors not inside the table.
I also tried: tc[i].BrickColor = BrickColor.new(Colors[math.random(#Colors)]) end end
While the second one did get only colors from the Colors table, they BOTH made all the part different colors instead of all one color.
I want them all to be one color, not a rainbow :/ |
|
|
| Report Abuse |
|
|
Noodess
|
  |
| Joined: 03 Jun 2012 |
| Total Posts: 347 |
|
|
| 27 Dec 2013 12:07 PM |
color = math.random(#Colors)
tc[i].BrickColor = BrickColor.new(color) end end
..? |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 12:12 PM |
| But that's exactly the same thing as the first try. The only difference is that you used a variable to call it, but it is the same thing. |
|
|
| Report Abuse |
|
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
|
| 27 Dec 2013 12:15 PM |
If you have a table of colors and you want a random one use rcolour = math.random(1, #Colors)
-- $$ Get on my level, here use this ladder. Don't fall down on the way up! $$ -- |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 12:17 PM |
| RIGHT! I completely forgot that when calling for math.random, you have to specify the origin, in this case designating the origin as 1 random color in the table. Jeez I'm so stupid. |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 12:18 PM |
| But I'm still getting a rainbow out of it. :/ |
|
|
| Report Abuse |
|
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
|
| 27 Dec 2013 12:19 PM |
Could you post the rest of the script?
-- $$ Get on my level, here use this ladder. Don't fall down on the way up! $$ -- |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 12:21 PM |
local tc = T.Chassis:GetChildren() for i = 1, #tc do if tc[i].Name == "TC" then tc[i].BrickColor = BrickColor.new(Colors[math.random(1, #Colors)]) end end |
|
|
| Report Abuse |
|
|
Azureous
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25287 |
|
|
| 27 Dec 2013 12:21 PM |
Example:
local colors = {'Bright blue', 'Really red', 'Violet'}
brick = Instance.new('Part', workspace) brick.Color = BrickColor.new(colors[math.random(1,#colors)]) |
|
|
| Report Abuse |
|
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
|
| 27 Dec 2013 12:22 PM |
Did you define Colors? Colors = {"Bright red", "Bright blue", "Magenta"} etc... |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 12:24 PM |
| Yes, I did. Not to sound rude, but look at my join date. I think I've been on roblox long enough to have earned some kind of trust in that I wouldn't forget such a trivial thing. :/ |
|
|
| Report Abuse |
|
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
|
| 27 Dec 2013 12:24 PM |
local tc = T.Chassis:GetChildren() leColor = math.random(1, #Colors) for i = 1, #tc do if tc[i].Name == "TC" then tc[i].BrickColor = BrickColor.new(Colors[leColor]) end end
-- $$ Get on my level, here use this ladder. Don't fall down on the way up! $$ -- |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 12:25 PM |
| Mic that's the same thing I just posted. Making the math.random a variable won't change the fact it didn't work. |
|
|
| Report Abuse |
|
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
|
| 27 Dec 2013 12:26 PM |
Reason: Each time you went through the loop it generated a new random colour. You should of defined the colour before the loop so it wouldn't run math.random numerous times.
-- $$ Get on my level, here use this ladder. Don't fall down on the way up! $$ -- |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 12:27 PM |
| Ok I'll try it then. It makes sense I guess o.o |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 12:28 PM |
| That fixed it. I'll try to remember that next time. Thank you very much. |
|
|
| Report Abuse |
|
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
|
| 27 Dec 2013 12:28 PM |
No problem c:
Glad to help.
-- $$ Get on my level, here use this ladder. Don't fall down on the way up! $$ -- |
|
|
| Report Abuse |
|
|
Noodess
|
  |
| Joined: 03 Jun 2012 |
| Total Posts: 347 |
|
|
| 27 Dec 2013 12:29 PM |
local tc = T.Chassis:GetChildren() local Color = math.random(1, #Colors) for i = 1, #tc do if tc[i].Name == "TC" then tc[i].BrickColor = BrickColor.new(Colors[Color]) end end |
|
|
| Report Abuse |
|
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
|
| 27 Dec 2013 12:30 PM |
Late^ Tryina copy me just changing the variables? >:o
-- $$ Get on my level, here use this ladder. Don't fall down on the way up! $$ -- |
|
|
| Report Abuse |
|
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
|
| 27 Dec 2013 12:32 PM |
| Not to worry, he tried to use your ladders. |
|
|
| Report Abuse |
|
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
|
| 27 Dec 2013 12:33 PM |
awwwhhh haiiil nawwwhhh
*knocks down ladders*
-- $$ Get on my level, here use this ladder. Don't fall down on the way up! $$ -- |
|
|
| Report Abuse |
|
|