|
| 22 Jan 2014 09:32 PM |
Hello and thanks for viewing this. I was wondering if there was a certain piece of code that could tell you or find how many of a certain part (with the same name) there is.
If you could direct me towards a Wiki link or let me know of the code, that'd be helpful! :D
Thanks, WrightRacer3n |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2014 09:38 PM |
function count(name, where) local amount = 0; for i, v in pairs(where:children()) do amount = amount + count(name, v); if v.Name == name then amount = amount + 1; end end return amount end
count("Brick", workspace) --example usage |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2014 09:42 PM |
| Thanks! :D I appreciate it! |
|
|
| Report Abuse |
|
|