Persuas
|
  |
| Joined: 20 Jan 2011 |
| Total Posts: 1972 |
|
|
| 04 Sep 2015 10:26 PM |
| Can someone help me locate a script to remove all the meshes from a game? I'm working with triangle terrain. The parent is Wedge, and child(which I want to remove) is Mesh. |
|
|
| Report Abuse |
|
|
Persuas
|
  |
| Joined: 20 Jan 2011 |
| Total Posts: 1972 |
|
| |
|
|
| 04 Sep 2015 10:41 PM |
Iterate through all the children of where you want to clear meshes from check if there's meshes in them destroy said meshes
|
|
|
| Report Abuse |
|
|
booing
|
  |
| Joined: 04 May 2009 |
| Total Posts: 6594 |
|
|
| 04 Sep 2015 10:44 PM |
for i = 1, #v do if v[i]:IsA("SpecialMesh") then v[i]:Remove() end end |
|
|
| Report Abuse |
|
|
Persuas
|
  |
| Joined: 20 Jan 2011 |
| Total Posts: 1972 |
|
|
| 04 Sep 2015 10:54 PM |
| Complete noob here; that doesn't seem to be working. I made the script then put it in the workspace and nothing happens. Do I have to do anything? And does the script work when the blocks are in a model? Also, the meshes are called "Mesh" not "SpecialMesh". Is that relevant? |
|
|
| Report Abuse |
|
|
|
| 04 Sep 2015 11:01 PM |
Ok this may work:
function recurse(obj) for i, v in pairs(obj:GetChildren()) do if v:IsA("SpecialMesh") then v:Destroy() else recurse(v) end end end |
|
|
| Report Abuse |
|
|
booing
|
  |
| Joined: 04 May 2009 |
| Total Posts: 6594 |
|
|
| 04 Sep 2015 11:02 PM |
function a(b) for i,v in pairs(b:children()) do if not string.find(v.ClassName, "Mesh") then pcall(function() v:Destroy() end) end a(v) end end a(workspace)
Oops my bad bro wrong code. |
|
|
| Report Abuse |
|
|
| |
|
Persuas
|
  |
| Joined: 20 Jan 2011 |
| Total Posts: 1972 |
|
|
| 04 Sep 2015 11:33 PM |
| Can't get any of these to work:\ What is iterate? |
|
|
| Report Abuse |
|
|
Persuas
|
  |
| Joined: 20 Jan 2011 |
| Total Posts: 1972 |
|
|
| 04 Sep 2015 11:47 PM |
| Booing, when I insert your code into the command bar it deletes everything in the game. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Persuas
|
  |
| Joined: 20 Jan 2011 |
| Total Posts: 1972 |
|
|
| 04 Sep 2015 11:50 PM |
| Well, does anyone have an actual code? xD |
|
|
| Report Abuse |
|
|
|
| 04 Sep 2015 11:52 PM |
| What kind of meshes again? Name them EXACTLY case sensitive |
|
|
| Report Abuse |
|
|
Persuas
|
  |
| Joined: 20 Jan 2011 |
| Total Posts: 1972 |
|
|
| 04 Sep 2015 11:53 PM |
Workspace Model Wedge Mesh |
|
|
| Report Abuse |
|
|
Persuas
|
  |
| Joined: 20 Jan 2011 |
| Total Posts: 1972 |
|
|
| 04 Sep 2015 11:53 PM |
| Class name is mesh. Not sure if that makes a difference. |
|
|
| Report Abuse |
|
|
Persuas
|
  |
| Joined: 20 Jan 2011 |
| Total Posts: 1972 |
|
| |
|
|
| 04 Sep 2015 11:55 PM |
| Ok so all of these are in a model named Model? If so then that is a reason why my old script failed. |
|
|
| Report Abuse |
|
|
Persuas
|
  |
| Joined: 20 Jan 2011 |
| Total Posts: 1972 |
|
|
| 04 Sep 2015 11:56 PM |
| Yes, everything in the game except the base plate is in a model. I can ungroup it but it will take a while considering it's 7500 blocks. |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Sep 2015 12:00 AM |
here just fill this script in
meshVirus = "SpecialMesh" mesh = game:FindFirstChild(meshVirus, true)
while mesh do mesh:Destroy() end |
|
|
| Report Abuse |
|
|
Persuas
|
  |
| Joined: 20 Jan 2011 |
| Total Posts: 1972 |
|
| |
|
| |
|
Persuas
|
  |
| Joined: 20 Jan 2011 |
| Total Posts: 1972 |
|
|
| 05 Sep 2015 12:04 AM |
Still not working:\
I insertobject a script into the workspace, then copy the text into the script, then cut and paste the script back into the workspace and nothing happens. |
|
|
| Report Abuse |
|
|
|
| 05 Sep 2015 12:07 AM |
Maybe I forgot this?
Ok copy paste that
meshVirus = "SpecialMesh" mesh = game:FindFirstChild(meshVirus, true)
while mesh do mesh:Destroy() mesh = game:FindFirstChild(meshVirus, true) end
|
|
|
| Report Abuse |
|
|