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:
- I create a Part
- I put it into workspace
- 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)
- 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)
- I play test the game
- I select the part with the selection tool
- I walk over the part
- 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