Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

3 comments

0

thanks so much! I will try and see if this works

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...

0

This works, you must be doing something wrong

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.

1 comment

0

thanks so much!

This discussion is preserved as it was. New answers, comments, and votes are closed.