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

Detect if part is destroyed?

Hello, I want to detect when a part has been deleted.

I've got no idea how to do this.

1 answer

✓ Accepted answer

Hello, isaacjh100!

To detect when a part is removed/deleted you can use ChildRemoved or DescendantRemoving. The following code I'm about to show is using the ChildRemoved event.

workspace.ChildRemoved:Connect(function(child)
	print(child)
end)

If you want it to run a something when a certain part is deleted you can do this:

workspace.ChildRemoved:Connect(function(child)
	if child.Name == "Part" then
		print("hey")
	end
end)

You can edit this code to your liking.

1 comment

0

Thank you :)

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