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

How remove Models if it is empty?

Hello, i want to remove models with the same name and i want only to delete these models when they are empty they have nothing inside how can i do this?

1 answer

✓ Accepted answer

Here is a script that removes empty models with a name that you set.

Hope this helps you!

local name = "testMod" -- name of the models you want to remove goes here

while true do
	wait()
	local mods = workspace:getChildren()
	for i,v in pairs(mods) do
		if v:IsA("Model") and v.Name == name and (#(v:getChildren())==0) then -- if it is a model with 0 items inside it
			v:remove()
		end
	end
end

2 comments

0

eh'

0

Gud one :3

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