Event Destroying() strange work. Explain please.))

Why is only one line output after deleting part? Where is the second line? After 3 second dont work.


local part = script.Parent

part.Touched:Connect(function()
	
	part:Destroy()

end)
part.Destroying:Connect(function()
	print("STROKE1")
	task.wait(3)
	print("STROKE2")
end)

Because after three seconds the part is destroyed, so any events attached to it get disconnected.

Okay, are there any alternatives so that there is some kind of expectation after the object is deleted?

Instead do your code after part:Destroy(), instead of in its own event.

My code works through Debris:AddItem(), so I’m looking for how to bind some event after deleting part.

Sorry for question, just the script was inside the part and when the part was deleted, the script too, and therefore everything did not work.)))

This doesn’t mean that any running callback function connected to that event will be stopped immediately.

local Game = game
local RunService = Game:GetService("RunService")

local Connection
local function OnRenderStep()
	Connection:Disconnect()
	print("Hello world!") --Is output once.
end

Connection = RunService.RenderStepped:Connect(OnRenderStep)