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

Removing something everytime it appears in workspace?

Asked by 8 years ago

How would I make it so the UFO gets removed every time it appears in workspace?

for _, child in pairs( workspace.Model:GetChildren()) do
    if child.Name = "UFO" then
      child:Destroy()
    end
end

1 answer

Log in to vote
1
Answered by 8 years ago

To do this its best to use the ChildAdded event. To do this you would basically write this:

game.Workspace.ChildAdded:connect(function(child)
    if child.Name == "UFO" then
        child:Destroy()
    end
end)
0
Our code is exactly the same but because used a link and were first you win. Ill delete my answer xD User#11440 120 — 8y
Ad

Answer this question