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

Trying to find its parent?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

I have workspace then a model called "CE" and I have a a part into it. In the part I have a script.

script.parent:remove()

I want to remove the model. Whats wrong?

2 answers

Log in to vote
0
Answered by 8 years ago

First Error, you forgot to capitalize "Parent" and remove() only works with scripts I believe. Try this:

script.Parent:Destroy() -- Destroy is a function used to remove something like a part.
0
And I did realize I forgot to add 1 more parent. You too.. Thanks for help! FiredDusk 1466 — 8y
0
No problem. deputychicken 226 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

The model is the parent of the part. The part is the parent of the script. Therefore, the model is script's parent's parent, not script's parent.

script.Parent.Parent:remove() -- The model, not the part.

Answer this question