Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cmdr/Shared/Util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Loading