From e06d115bf132bc175b9d92b5cc15939749b21ea1 Mon Sep 17 00:00:00 2001 From: itsrenderman <27890173+itsrenderman@users.noreply.github.com> Date: Fri, 27 Dec 2024 12:06:13 +0000 Subject: [PATCH] Add player display names and merge Util.GetNames into transformInstanceSet --- Cmdr/Shared/Util.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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