Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 04 Oct 2014 07:13 PM |
There is apparently an error at the second parenthesis behind (m:GetChildren))]. I've tried fixing it myself but it won't work. Help?
function reduce(t) local ret = {} local i = 1 for _,v in pairs(t) do if v:IsA("Tool") then ret[i] = v i = i+1 end return ret end
m = script.Parent -- assumes script parent is the model m.ClickDetector.Mouse1Clicked(function() -- I don't actually know the clicked event for clickdetectors reduce(m:GetChildren())[math.random(1, #reduce(m:GetChildren))]:Clone() end) |
|
|
| Report Abuse |
|
|
ohno1112
|
  |
| Joined: 23 Mar 2013 |
| Total Posts: 833 |
|
|
| 04 Oct 2014 07:27 PM |
you are doing :GetChildren))
obviously, it SHOULD be :GetChildren() |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 04 Oct 2014 07:35 PM |
| Now its saying the ] after it is invalid too. |
|
|
| Report Abuse |
|
|
|
| 04 Oct 2014 07:39 PM |
m = script.Parent m.ClickDetector.MouseClick:connect(function() reduce(m:GetChildren()[math.random(1, #reduce(m:GetChildren())]:Clone() end)
|
|
|
| Report Abuse |
|
|
darthpyro
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 3569 |
|
|
| 04 Oct 2014 07:39 PM |
reduce(m:GetChildren())[math.random(1, #reduce(m:GetChildren()))]:Clone()
|
|
|
| Report Abuse |
|
|