model:GetExtentsSize() caches size value unexpectedly

For an instance hierarchy such as this:

Model → Part1 → Part2

When destroying Part2 and immediately calling :GetExtentsSize() on the model, it returns the previous model size, inlcluding Part1 and Part2. I would expect the call to return the model size after destroying Part2.

This happens in Studio and in published experiences.

I don’t know when this started happening. I only noticed it today.

Steps to reproduce:

Create a blank project and add this in a server script:

local model=Instance.new("Model",workspace)
local part=Instance.new("Part",model)
model.PrimaryPart=part
local bigPart=Instance.new("Part",part)
print(model:GetExtentsSize())
bigPart.Size=Vector3.one*10
print(model:GetExtentsSize())
bigPart:Destroy()
print(model:GetExtentsSize())
model:Destroy()

Output:

image

If the thread is yelded, or if the destroyed part was parented directly to the model, the issue goes away:

1 Like

Thanks for the report! I filed a ticket in our internal database and we’ll follow up when we have an update for you.

1 Like