The title I wanted to use: “How do I delete the parent (folder) of a child (part/brick) using a table (the folder2 the folder is in) based on if any child of the parent moved”

I'm trying to make my code recognize if any part/brick in a folder moves and if it does I want to destroy/delete the folder the part is in

A picture of the folders and bricks https://cdn.discordapp.com/attachments/ 655204675053682700/752124872926298132/ parts.png

(just piece the parts together to get a full link)

while true do
	for i, c in pairs(game.Workspace.Walls:GetDescendants())do
		if c:IsA("BasePart")then
			c:GetPropertyChangedSignal("CFrame"):Connect(function()
				wait(2)
				c:Destroy()
			end)
		end
	end
	wait()
end

1 comment

0

i recommend you use "v" instead of "c" instead but its ok if u dont want