ntmcd
|
  |
| Joined: 07 Oct 2011 |
| Total Posts: 2432 |
|
|
| 18 Apr 2014 09:21 AM |
This script should print the number of tools named 'Tool' in workspace every 3 seconds. It prints the correct number the first time and 0 every time after. x=1 function GetAllChildren(Parent, lol) for _, Child in pairs(Parent:GetChildren()) do if Child.Name == 'SAXXXTON' then lol[x] = Child x = x+1 end GetAllChildren(Child, lol) end return #lol end val = {} val1 = {} while true do a = GetAllChildren(game.Workspace, {}) b = GetAllChildren(game.Players, {}) print(a+b) wait(3) end |
|
|
| Report Abuse |
|
|
ntmcd
|
  |
| Joined: 07 Oct 2011 |
| Total Posts: 2432 |
|
| |
|
|
| 18 Apr 2014 09:29 AM |
while true do
tools = 0 number = Workspace:GetChildren()
for i = 1, #children then
if number[i].Name == "Tool" then tools = tools + 1 end
end
print(tools) wait(3) end |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2014 09:29 AM |
while true do
tools = 0 number = Workspace:GetChildren()
for i = 1, #number then
if number[i].Name == "Tool" then tools = tools + 1 end
end
print(tools) wait(3) end |
|
|
| Report Abuse |
|
|
| |
|
ntmcd
|
  |
| Joined: 07 Oct 2011 |
| Total Posts: 2432 |
|
|
| 18 Apr 2014 09:53 AM |
| i need the function to be recursive |
|
|
| Report Abuse |
|
|
ntmcd
|
  |
| Joined: 07 Oct 2011 |
| Total Posts: 2432 |
|
| |
|