Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is this script not working?

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

1 answer

✓ Accepted answer

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)

1 comment

0

Thanks man! That certainly seemed to fix it.

This discussion is preserved as it was. New answers, comments, and votes are closed.