This command will organize your messy workspace into neat folders

I made it with all my years of experience scripting


	local workspacechildren = {}

	for i,v in workspace:GetChildren() do
		if v:IsA("Camera") or v:IsA("Folder") or v:IsA("Terrain") then continue end
		table.insert(workspacechildren, v)
	end

	local data = {

	}
	for i,v in workspacechildren do
		data[v.ClassName] = data[v.ClassName] or {}
		data[v.ClassName][v.Name] = data[v.ClassName][v.Name] or {}
		table.insert(data[v.ClassName][v.Name], v)
	end
	print(data)
	
	for foldername, list in data do
		local newf = Instance.new("Folder", workspace) newf.Name = foldername
		for nameofitem, objecttable in list do
			local folder = newf:FindFirstChild(nameofitem) or Instance.new("Folder", newf) folder.Name = nameofitem
			for i,v in objecttable do 
				v.Parent = folder
			end
		end
	end
	

Copy paste this and run it into your command bar

2 Likes

So it’s organized into folders with ClassName as the name?

yes. This is very useful because sometimes u might have things that u dont need in ur workspace and u can just delete them.

The builders that i worked with were very disorganized and didn’t know what a folder was. It was tiring for me to scroll up and down all the time.

Tbh i don’t care how workspace looks, since it’s just a container holding physical stuff. As long the other containers aren’t messy i am fine with workspace being messy.