diff --git a/Cmdr/Shared/Util.lua b/Cmdr/Shared/Util.lua index 58087eb9..5e152821 100644 --- a/Cmdr/Shared/Util.lua +++ b/Cmdr/Shared/Util.lua @@ -42,7 +42,12 @@ local function transformInstanceSet(instances) local names = {} for i = 1, #instances do - names[i] = instances[i].Name + local object = instances[i] + if typeof(object) == "Instance" and object:IsA("Player") then + names[i] = if object.DisplayName == object.Name then object.Name else `{object.DisplayName} ({object.Name})` + continue + end + names[i] = object.Name or tostring(object) end return names, instances @@ -122,12 +127,7 @@ end If no Name property is present, then tostring will be called instead. ]=] function Util.GetNames(instances: any): { string } - local names = {} - - for i = 1, #instances do - names[i] = instances[i].Name or tostring(instances[i]) - end - + local names, _ = transformInstanceSet(instances) return names end