replica:OnDestroy(listener: () -> ()): () -> ()
Server & ClientFires once when the Replica is destroyed (server-side Destroy() or the client receiving the destroy notification).
Parameters
listener*() -> () | Called with no arguments when the Replica is destroyed. |
Returns
() -> ()Disconnect function, to unregister the listener without waiting for destruction.
replica:OnDestroy(function()
print("Replica gone:", replica.Token)
end)