drgn42
|
  |
| Joined: 11 Feb 2010 |
| Total Posts: 3231 |
|
|
| 11 Jan 2015 09:42 PM |
My script isn't finding any of the children. It never displays does not meet standards and it always prints 0. I'm new to for statements, and am trying to learn. Thanks for your patients.
script.Parent.MouseButton1Down:connect(function() a = 0 function Index(i) for i,v in pairs(script.Parent.Parent:GetChildren()) do if v.Name == "NewDocument" or v.Name == "BlankSheet" then print("Does not meet Standards") else a = a+1 end end end print(a) end) |
|
|
| Report Abuse |
|
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
|
| 11 Jan 2015 09:43 PM |
You never called the function!
script.Parent.MouseButton1Down:connect(function() a = 0 for i,v in pairs(script.Parent.Parent:GetChildren()) do if v.Name == "NewDocument" or v.Name == "BlankSheet" then print("Does not meet Standards") else a = a+1 end end print(a) end) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 11 Jan 2015 09:43 PM |
| You never called the Index function, and creating a function every time the event is triggered is very inefficient :) |
|
|
| Report Abuse |
|
|
drgn42
|
  |
| Joined: 11 Feb 2010 |
| Total Posts: 3231 |
|
|
| 11 Jan 2015 09:46 PM |
| Oh my heck. Thanks for pointing that out. |
|
|
| Report Abuse |
|
|