Properties widget attributes behave badly with ChangeHistoryService

Reproduction Steps
Plugins using ChangeHistoryService to record changes to instance attributes can cause the properties widget to get into a bad state. To reproduce, open the default place in Roblox Studio and with Workspace selected, run the following code in the command bar:

local ChangeHistoryService = game:GetService("ChangeHistoryService")
local RunService = game:GetService("RunService")

ChangeHistoryService:SetWaypoint("Setting oops to 0")
workspace:SetAttribute("oops", 0)
ChangeHistoryService:SetWaypoint("Set oops to 0")

ChangeHistoryService:SetWaypoint("Setting oops to nil")
workspace:SetAttribute("oops", nil)
ChangeHistoryService:SetWaypoint("Set oops to nil")

ChangeHistoryService:Undo()
RunService.Heartbeat:Wait() 
ChangeHistoryService:Redo()

The properties widget should now display the attribute with a red outline around its value field (see images below).

It will continue to look this way after the selection changes and the selected instance(s) do not have the attribute. If the selection changes to an instance that does have the attribute, something a bit different happens. With Workspace selected, run the following in the command bar:

local ChangeHistoryService = game:GetService("ChangeHistoryService")
local RunService = game:GetService("RunService")
local Selection = game:GetService("Selection")

ChangeHistoryService:SetWaypoint("Setting oops to 0")
workspace:SetAttribute("oops", 0)
ChangeHistoryService:SetWaypoint("Set oops to 0")

ChangeHistoryService:SetWaypoint("Setting oops to nil")
workspace:SetAttribute("oops", nil)
ChangeHistoryService:SetWaypoint("Set oops to nil")

ChangeHistoryService:Undo()
RunService.Heartbeat:Wait() 
ChangeHistoryService:Redo() 

workspace.Baseplate:SetAttribute("oops", 0) 
Selection:Set({ workspace.Baseplate })

Now the properties widget should say that this attribute is of <Multiple Types> (see images below).

This issue occurs on Roblox Studio version 0.485.0.425755, whether using ChangeHistoryService:Undo / ChangeHistoryService:Redo or the corresponding commands (i.e. Ctrl+Z / Ctrl+Y).

Expected Behavior
I expect the properties widget to not display attributes that were set to nil after an undo or redo.

Actual Behavior
image

image

Issue Area: Studio
Issue Type: Display
Impact: Moderate
Frequency: Often

5 Likes

Can you still reproduce this? Iā€™m not seeing this behavior anymore.