Studio crash when attribute on selected part is set to nil after being destroyed

This was a bug I found in my game, I have reduced the two large scripts that caused the issue to just a few lines of code.
Reproduction Steps:

  1. I create a Part
  2. I put it into workspace
  3. I give it an attribute like “Attribute” (or any other name) and set it to a number/boolean/UDim/UDim2/BrickColor/Color3/Vector2/Vector3/CFrame/NumberSequence/ColorSequence/NumberRange/Rect/Font (it won’t crash when it’s a string)
  4. Then I make a LocalScript (it won’t crash when it is a server script), like this one:
local Object = workspace:WaitForChild("Part")
Object.Touched:Connect(function()
	Object:Destroy()
	Object:SetAttribute("Attribute", nil) -- Crashes studio if the part is selected
end)
  1. I play test the game
  2. I select the part with the selection tool
  3. I walk over the part
  4. I crash

What I think is causing the crash:
The crash happens when an attribute of type number/boolean/UDim/UDim2/BrickColor/Color3/Vector2/Vector3/CFrame/NumberSequence/ColorSequence/NumberRange/Rect/Font is set to nil after the part is destroyed AND the part was selected.

Visual Aids:
(Not crashing while not selected)


(Crashing while selected)

System Information:
Intel Core i5-11400H @ 2.70 GHz, 16 GB, NVIDIA GeForce RTX 3050 Ti
Beta Features Enabled: None
Reproduction File: CrashTest.rbxl (49.3 KB)

Expected behavior

I expect it not to crash studio.

A private message is associated with this bug report

1 Like

This is just an acknowledgment announcement!

We’ve filed a ticket into our internal database for this issue, and will come back as soon as we have updates!

Thanks for flagging!

1 Like