Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

I need help with my script... It is supposed to delete all meshes from my place, any ideas?

Asked by 10 years ago

Hi, I have a script already that my friend made me... Its purpose was to remove all the meshes from my world, only issue is that it only removes it from un-grouped meshes... Could anybody help? here is the script: function check(part) if part:IsA("Mesh") then part:Destroy() else for i, v in pairs(part:GetChildren()) do check(v) end end end

I need the script to search through everything on my world, IE. through groupings of blocks and then meshes attached to those blocks...

Thanks so much for the help!

2 answers

Log in to vote
0
Answered by 10 years ago
function RemoveMesh(Object)
    for _,v in pairs(Object:GetChildren()) do
        if v.ClassName == "SpecialMesh"
        or v.ClassName == "CylinderMesh"
        or v.ClassName == "BlockMesh" then
            v:Destroy()
        end
        RemoveMesh(v)
    end
end

You would call the function like this:

RemoveMesh(--[[Place the path to the brick here]]--)
--Example:
RemoveMesh(game.Workspace.Model)
0
thanks so much! I will try and see if this works pepstick 10 — 10y
0
That didnt seem to work... Also the mesh I am in need of removing isnt called any one of those three, its just called Mesh, and I know i could just change the name to Mesh but that didn't seem to work... pepstick 10 — 10y
0
This works, you must be doing something wrong TurboFusion 1821 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Here is a script that I'd probly use to remove Meshes;

c = workspace:children()
for i=1,#c do
if c[i].className=="MESHCLASSNAME"then
c[i]:remove()
end
if c[i].className=="Model" or c[i].className=="Part" then
ci=c[i]:children()
for i2=1,#ci do
if ci[i2].className=="MESHCLASSNAME"then
ci[i2]:remove()
end end

But your also using a function.. So..


c=workspace:Children() CleanUp=true if CleanUp then function Clean() for i=1,#c do if c[i].className=="MESHCLASSNAME"then c[i]:remove() end end end elseif not CleanUp then print("Set CleanUp to true for CleanUp") end CleanUp() --Forgot to add this, sorry.

Sorry if this was not what you were looking for.

0
thanks so much! pepstick 10 — 10y

Answer this question