|
| 23 Nov 2011 01:21 PM |
if msg == "rockdeath/flappydavid" then x = plr.Character:GetChildren() for i,v in pairs(x) do if v.ClassName == "Part" then z = math.random(1,v) z:remove() end end end
This is a part of a command script that I made that does NOT work... Why is this? I tried z = math.random(1,v) and z = math.random(1,#i) |
|
|
| Report Abuse |
|
|
| |
|
tdog158
|
  |
| Joined: 08 Jul 2008 |
| Total Posts: 5413 |
|
|
| 23 Nov 2011 01:27 PM |
z = math.random(1,i)
Don't use #i, since i in this case returns a number, and v returns a value (based on the contents of your table, which in this case are the players.) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
tdog158
|
  |
| Joined: 08 Jul 2008 |
| Total Posts: 5413 |
|
|
| 23 Nov 2011 01:32 PM |
Ah, I see what you are trying to do.
if msg == "rockdeath/flappydavid" then x = plr.Character:GetChildren() for i,v in pairs(x) do if v.ClassName == "Part" then x[math.random(1,#x)]:remove() end end end |
|
|
| Report Abuse |
|
|