For context, the model is a vehicle. An explosion can damage it but it will still work. I've included a non-collidable part in the vehicle so when it blows up, the part will fall and get destroyed by the void. I want the vehicle to stop working after it gets damaged, so I tried coming up with a system that detects if the part has been destroyed which will disable the vehicle. I tried doing if (part) == nil then (vehicle stops working), but that doesn't work. I looked through similar questions from the past and read through the wiki, but I still can't find a solution. I don't need help with the disabling of the vehicle, I just need help with finding a way of detecting if a part still exists.
✓ ANSWER ACCEPTED
How can I check if a specific part from a model has been destroyed?
2 answers
✓ Accepted answer
if Model:FindFirstChild("PartYourLookingFor") then
--Dostuff
end
model = script.Parent
partToRemove = model:FindFirstChild "PART_NAME_HERE"
model.ChildRemoved:Connect (function (p)
if p == partToRemove then
print (p.Name .. " was removed!")
end
end)
1 comment
0
You could also replace ChildRemoved with DescendantRemoving if you need that part before it gets destroyed.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Also combine with or substitute with ChildRemoving
oh yea that too