How do you go about deleting everything that's in a folder?

Hello! I’d like to know how do you delete everything in a folder? I’ve tried :clearallchildren, but it doesn’t work.

6 Likes

Hey! Have you tried :GetChildren then deleting every child? I can’t really explain it since I don’t think I know it that well but heres a snippit of code that may or may not came from a free model.

	local folder = game.Workspace.Folder
	for i=1, #folder do 
			folder[i]:Destroy()
	end

I havent tested this yet, but I think it might work.

2 Likes

You can also make an in pairs loop that calls :Destroy() on all children.
Example:

for i,v in pairs(folder:GetChildren()) do
     v:Destroy()
end)
13 Likes