Roblox hasn’t fully released that event yet. Use GetPropertyChangedSignal instead to detect when the parent property changes to nil.
local Part = workspace:WaitForChild("Part")
Part:GetPropertyChangedSignal("Parent"):Connect(function()
if not Part.Parent then
print("destroyed")
end
end)
local Folder = Instance.new("Folder")
Folder.Parent = workspace
local Part = Instance.new("Part")
Part.Parent = Folder
Folder.ChildRemoved:Connect(function(child)
if (child == Part) then
print(Part, "Destroying");
end
end)
task.wait(1)
Folder:Destroy()
Part:Destroy()
This is also a good work-around for a bug where a custom character does not trigger a died, destroyed, or removing event when it falls into the void! Thanks!
local diedToVoidEvent: RBXScriptConnection
diedToVoidEvent = char:GetPropertyChangedSignal("PrimaryPart"):Connect(function()
if not char.PrimaryPart then
print(player,'died to void.')
diedToVoidEvent:Disconnect() --make a new connection inside CharacterAdded event
wait(game.Players.RespawnTime)
player:LoadCharacter()
end
end)