Destroying an unparented Instance doesn't replicate

Reproduction Steps

On the Server:

instance.Parent = nil
instance:Destroy()

Expected Behavior

Instance should be destroyed on the Client, but replication is disabled after parenting it to nil.

Actual Behavior

Instance is not destroyed on the Client.

Issue Area: Engine
Issue Type: Other
Impact: Low
Frequency: Very Rarely

2 Likes

When you destroy something, the variable doesn’t go to nil, but the object does. This is convenient at times. But to see if a destroyed object is there, just check if it has a parent.

This isn’t a bug, it’s just part of the Replication contract - we only replicate changes for objects that are actively being replicated. Once an object is un-parented, (i.e. removed from the DataModel, and no longer under a Replicating Service like ReplicatedStorage, Workspace, etc.), it is no longer being replicated, and future updates (i.e. the Instance being Destroy()ed), will not be replicated.

If you want the Destroy() to be replicated, you need to call Destroy() on the Instance whilst it’s still being actively replicated, i.e. when it’s still part of the DataModel as the descendant of a Replicating Service.

5 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.