I would like this script to remove the parent part when the joint is broken. Can anyone help me?
if
script.parent["Following Brick_weld"] == nil
then
script.Parent:Destroy()
end
I would like this script to remove the parent part when the joint is broken. Can anyone help me?
if
script.parent["Following Brick_weld"] == nil
then
script.Parent:Destroy()
end
Well, you'd need to be able to detect when it's destroyed, so I recommend using the ChildRemoved event. So:
script.Parent.ChildRemoved:connect(function(part)
if part.Name == "Following Brick_weld" then
script.Parent:Destroy()
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Thanks man! That certainly seemed to fix it.