Carbon882
|
  |
| Joined: 10 Jan 2013 |
| Total Posts: 664 |
|
|
| 01 Nov 2015 06:40 PM |
| So me my friend play Mini Building Domination and we insert unit sets. A lot of them are infected with fire and it lags the game badly. Is there any script out there what would remove fire from the sets as we insert it? |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2015 06:43 PM |
| Maybe you should find a set that isn't infected. |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2015 07:08 PM |
Sometimes you find viruses in the model library. What you need is recursion.
for i,v in pairs(game.Workspace:GetChildren()) do v:FindFirstChild("Fire"):Destroy() for ii,vv in pairs(game.Workspace:GetChildren()) do vv:FindFirstChild("Fire"):Destroy() for iii, vvv in pairs(game.Workspace:GetChildren()) do vvv:FindFirstChild("Fire"):Destroy() end end end
Basically, this loops through (for index, value in pairs loops through the table that GetChildren() returns) different hierarchical levels of your workspace (that's where the game.Workspace:GetChildren() comes from) and attempts to find the first child of the v returned named fire (FindFirstChild("Fire")) and we keep adding onto the initial loop by adding more loops inside of that loop. The initial loop scans the first level of children inside workspace, the second loop scans the children of those children, and the third loop scans the children of those children. So keep adding more loops depending on how far you need to look for fire. This might've been unclear unless you have knowledge of tables but I hope you understood the directions. So..good luck. Next time you have a problem like this, post in the Scripters subforum for faster help. |
|
|
| Report Abuse |
|
|
Carbon882
|
  |
| Joined: 10 Jan 2013 |
| Total Posts: 664 |
|
| |
|
| |
|