Instance parameters not guaranteed to be replicated before being destroyed (yet children are)

Modified Parameters/Attributes of an Instance are not guaranteed to be replicated before the object is destroyed for the Client.
This means if I attach an attribute an object, then delete it to soon, the Client will not be able to read this attribute at all.
However, it seems like adding child objects to the Instance being destroyed will still get replicated before it’s destroyed.

Here’s a small repro I made in an empty baseplate showcasing the issue.


client code:

Addendum: for the sake of covering my bases, I also tested using .Destroying instead of .AncestryChanged and it yields the same results

Here’s the repro place:
ObjectParamsNoReplicateBeforeDestroyed.rbxl (41.4 KB)

5 Likes

Thanks for the report! We’ve filed a ticket in our internal database.

1 Like

Hey, apologies for late response.

In general the property being updated on a deleting instance is not supported. The Roblox engine is designed such that we move towards a concept of “Eventual Consistency”, meaning the latest state of the world is prioritized.

This means if you create an object, change some properties, and then delete the object, the final property changes are not guaranteed to arrive. The engine assumes that the deletion of the object makes those final changes irrelevant.

Is there a specific use-case you were relying on this for?

2 Likes

All good,
The usecase is a bit messy to write out all at once. I’m trying to spawn client ragdolls when server animals are destroyed in my game.

server destroys animal, client sees instance destroyed, spawns a ragdoll where the instance just was, reads some metadata about the animal to know how to setup the ragdoll.

However, this metadata needs to arrive at the same time as the object is being destroyed. This is tough because it’s generated on the same frame as it’s being destroyed, so I need a way to guarantee both the instance being destroyed and the metadata are given to the client at the same time.

Hope that info helps.
Cheers!

1 Like

Does a RemoteEvent sufficiently resolve your use case for this as a workaround?

I can see how replicating “final state before Destroy” can be helpful in some cases, my concern is that in most scenarios this behavior would cause a loss of bandwidth without much utility. Want to understand whether there is something else we could provide or whether RemoteEvents work well in this scenario.

1 Like

You’re correct, that’s a fine workaround. I just thought the lack of replication before being destroyed was an unintentional bug. But now that I’m aware this is done for optimizing bandwidth, I can use other methods to accomplish my goals, like using a simple remote event call. Thanks for the clarification on this topic.

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