Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How remove Models if it is empty?

Asked by 8 years ago
Edited 8 years ago

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

Log in to vote
1
Answered by 8 years ago

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

Hope this helps you!

01local name = "testMod" -- name of the models you want to remove goes here
02 
03while true do
04    wait()
05    local mods = workspace:getChildren()
06    for i,v in pairs(mods) do
07        if v:IsA("Model") and v.Name == name and (#(v:getChildren())==0) then -- if it is a model with 0 items inside it
08            v:remove()
09        end
10    end
11end
0
eh' User#11440 120 — 8y
0
Gud one :3 User#11440 120 — 8y
Ad

Answer this question