sal212
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 2929 |
|
|
| 07 Feb 2016 10:41 PM |
How would you pick a random thing from my table?
local yellow3 = 255, 255, 255 local red3 = 255, 0, 0 local orange3 = 255, 106, 0 local black3 = 0, 0, 0 local ctable = {yellow3,red3,orange3,black3}
|
|
|
| Report Abuse |
|
|
|
| 07 Feb 2016 10:42 PM |
| local random = ctable[math.random(1,#ctable)] |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 07 Feb 2016 10:42 PM |
local yellow3 = Color3.new(1, 1, 1) local red3 = Color3.new(1, 0 ,0) local orange3 = Color3.new(1, 106/255, 0) local black3 = Color3.new(0, 0, 0) local ctable = {yellow3,red3,orange3,black3}
local randomcol = ctable[math.random(#ctable)] |
|
|
| Report Abuse |
|
|
sal212
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 2929 |
|
| |
|
gergy008
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 7039 |
|
|
| 07 Feb 2016 10:44 PM |
Can I be that one guy to explain that there's no such thing as random? No? okay...
Play today! So much fun the more people that join: http://www.roblox.com/games/2047642/NEW-Build-A-Fortune-v0-9-6-Fixes |
|
|
| Report Abuse |
|
|
sal212
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 2929 |
|
|
| 07 Feb 2016 11:00 PM |
Once I click a part and it chooses a random color, if I click it again, it would keep choosing the same color it first had when I clicked it first. For example, if I clicked it and it chose black, and keep clicking again, it will keep choosing black. Is this a problem on roblox's end?
local yellow3 = Color3.new(255, 255, 0) local red3 = Color3.new(1, 0 ,0) local orange3 = Color3.new(1, 106/255, 0) local black3 = Color3.new(0, 0, 0) local ctable = {yellow3,red3,orange3,black3} local randomcol = ctable[math.random(#ctable)] function Click() game.Workspace.StairWalls.StairWall1.Smoke.Color = randomcol wait(.2) print(randomcol) end
script.Parent.ClickDetector.MouseClick:connect(Click)
|
|
|
| Report Abuse |
|
|
gergy008
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 7039 |
|
|
| 07 Feb 2016 11:03 PM |
try adding
#code print(math.random())
to your script and seeing if you get random numbers in output
Play today! So much fun the more people that join: http://www.roblox.com/games/2047642/NEW-Build-A-Fortune-v0-9-6-Fixes |
|
|
| Report Abuse |
|
|
sal212
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 2929 |
|
|
| 07 Feb 2016 11:06 PM |
Its giving me different numbers
|
|
|
| Report Abuse |
|
|
gergy008
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 7039 |
|
|
| 07 Feb 2016 11:07 PM |
Figured it out.
You're picking a colour, but never changing it local yellow3 = Color3.new(255, 255, 0) local red3 = Color3.new(1, 0 ,0) local orange3 = Color3.new(1, 106/255, 0) local black3 = Color3.new(0, 0, 0) local ctable = {yellow3,red3,orange3,black3} local randomcol = ctable[math.random(#ctable)] function Click() game.Workspace.StairWalls.StairWall1.Smoke.Color = randomcol wait(.2) print(randomcol) end script.Parent.ClickDetector.MouseClick:connect(Click)
should be
local yellow3 = Color3.new(255, 255, 0) local red3 = Color3.new(1, 0 ,0) local orange3 = Color3.new(1, 106/255, 0) local black3 = Color3.new(0, 0, 0) local ctable = {yellow3,red3,orange3,black3} function Click() game.Workspace.StairWalls.StairWall1.Smoke.Color = ctable[math.random(#ctable)] wait(.2) print(randomcol) end script.Parent.ClickDetector.MouseClick:connect(Click)
Play today! So much fun the more people that join: http://www.roblox.com/games/2047642/NEW-Build-A-Fortune-v0-9-6-Fixes |
|
|
| Report Abuse |
|
|
sal212
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 2929 |
|
| |
|