|
| 07 Sep 2013 10:24 PM |
So my friend has an infection problem. Every brick has something named fire in it. So I'm trying to write something out that deletes it
local children = Workspace:GetChildren() for i = 1, #children do if children[i].ClassName="Brick" then children.Fire:Destroy() end end
What's wrong with this script though? And also how would I get it so it runs when the server starts? |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:26 PM |
| Or maybe you should tell him to stop using free-models and wasting your time? |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:27 PM |
Look, kid.
Free models are free, if he wants to use them he can. I'm trying to help someone out. So stop acting so cool because you have 700 posts.
This is scripting helpers. If you're not here to help but just to post, then get out. |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:29 PM |
._. Welp
fien
local children = Workspace:GetChildren() for i, v in pairs(children) do if v.ClassName="Brick" then v.Fire:Destroy() end end
That should work, |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 07 Sep 2013 10:30 PM |
| PM'ed it to you, due to roblox blocking it |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:30 PM |
local children = Workspace:GetChildren() for i, v in pairs(children) do if v.ClassName="Part" then v.Fire:Destroy() end end
Thanks. I also forgot the class name is Part not Brick. |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:31 PM |
@SoQuick,
No you didn't..
Also, how do I get it so it runs when a server is started? |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:31 PM |
| Oh yeah, I forgot to remove that from mines ._. derp. |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:32 PM |
| @TheShoeBox, it should already do that automatically. |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:33 PM |
Alrighty tighty.
Thanks! He'll be glad I got it to him. |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:38 PM |
local children = Workspace:GetChildren() for i, v in pairs(children) do if v.ClassName="Part" then v.Fire:Destroy() v.Guest_Talking_Script:Destroy() end end
He said he put it in command bar and it didn't work.
Any other suggestions? |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 07 Sep 2013 10:39 PM |
| I PM'ed you one, it should work. |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:39 PM |
local children = Workspace:GetChildren() for i, v in pairs(children) do if v.ClassName=="Part" then v.Fire:Destroy() v.Guest_Talking_Script:Destroy() end end
Nvm, solved it. Need a double equals sign xD |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:40 PM |
| I didn't get one btw @Quick |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:44 PM |
Seriously, if he's going to use free models, he should have to deal with the consequences of using them. Regardless of this, here's a script to help out your friend. Tell him to be more cautious next time.
recurse = function(dir) for i, v in pairs(dir:GetChildren()) do if v.Name == "Fire" then v:Destroy() elseif v.Name ~= "Fire" and #v:GetChildren() > 0 then recurse(v) end end end
recurse(Workspace) |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:46 PM |
Wait... It seems to not work if Fire/Guest_Talking_Script isn't in the brick.
How would I check if it's in the brick? Would this work?
local children = Workspace:GetChildren() for i, v in pairs(children) do if v.ClassName=="Part" then if v.Fire~=nil then v.Fire:Destroy() end if v.Guest_Talking_Script~=nil then v.Guest_Talking_Script:Destroy() end end end |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:49 PM |
Thankyouuu.
And also I just have a bit of empathy for him since I used FMs once too.
|
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:58 PM |
function fix(parent) if (#parent:GetChildren()>0) then for _,v in pairs(parent:GetChildren()) do if (v:IsA("Fire") or v.Name=="Guest_Talking_Script") then v:Destroy() end fix(v) end end end fix(game.Workspace) |
|
|
| Report Abuse |
|
|