I need a way to convert this from GetNameFromUserIdAsync to GetUserInfosByUserIdsAsync so I can get both displayname and usernames for changing GUI text.

"Captain" is a Title in the _G.ShipPositions Table that has UserID as the Key and Title as the value.

wait(1)
sp = script.Parent

local function getCurrentPlayerOfTitle(title: string)
	for k,v in pairs(_G.ShipPositions or {}) do
		if title == "N/A" then print ("Key Was N/A Returning Unassigned CAPTAIN SCRIPT") return "Unassigned" end
		if v == title then return game:GetService("Players"):GetNameFromUserIdAsync(k) or "Unassigned" end
	end
	return "Unassigned"
end

coroutine.wrap(function()
	while task.wait() do
		sp.Text = getCurrentPlayerOfTitle("Captain").."'s Quarters"
	end
end)()

Update

I am currently trying this, however i am not getting successOrNot to print

wait(1)
unl = script.Parent.UserNameLabel
dnl = script.Parent.DisplayNameLabel

local UserService = game:GetService("UserService")

local ShipRole = "Captain"


local function getCurrentPlayerOfTitle(title: string)
	for k,v in pairs(_G.ShipPositions or {}) do
		if title == "N/A" then print ("Key Was N/A Returning Unassigned CAPTAIN SCRIPT") return "Unassigned" end
		if v == title then

			local successOrNot, result = pcall(function()
				--print ("Fetching Info")
				return UserService:GetUserInfosByUserIdsAsync(k)
			end)
						
			if successOrNot == true then
				print ("Success Is True")
				for user, userInfos in ipairs(result) do
					print("Your UserId = "..userInfos.Id)
					print("Your Username = "..userInfos.Username)
					print("Your DisplayName = "..userInfos.DisplayName)
					
					unl.Text = userInfos.Username.."'s "
					dnl.Text = "("..userInfos.DisplayName..")"
					
				end
			end
			
		end
	end
end

coroutine.wrap(function()
	while task.wait() do
		getCurrentPlayerOfTitle(ShipRole)
	end
end)()