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

Is there a way to detect when a model by a specific name is in the workspace?

Asked by 8 years ago

For what I want to do, I have a script that copies a model I have in lighting, and places the copy into game.Workspace and I need a way to detect it so when the model enters, it runs a function.

1 answer

Log in to vote
2
Answered by
Sublimus 992 Moderation Voter
8 years ago
Edited 8 years ago

To do this, you can use the ChildAdded() event.

game.Workspace.ChildAdded:connect(function(newChild) -- Run when child is added, set newChild as pointer to the child
    if newChild.Name == "blah" then -- If the name of the child is whatever
        yourFunction() -- Run your function
    end
end)
Ad

Answer this question