This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts.
This function enables developers to request information about users outside of the current Datamodel in bulk, which is why both the input and output values are arrays.
- The order of the
UserInfosResponseobjects in the return value’s array may not match the order of the
UserIdssent in the input parameter’s array. Use the
Idfield of the
UserInfosResponseobject to identify your input array with the output array.
- It’s possible to receive less
UserInfoResponseobjects than requested if one or more of the
userIdsin the request array are invalid, such as negative numbers or user ID’s that don’t have accounts associated with them. It’s possible to receive a response with zero results if all userIds are invalid.
- If a Roblox user does not have a display name associated with their account, the function will return instead the same string as the user’s username in the
DisplayNamefield. See Player.DisplayName. While a user’s UserId will never change, a user may change their username or display name. The same input
UserIdsmay return a different string for these fields from one day to another.
GetUserInfosByUserIdsAsync()makes an external web request, it will yield and may fail if the backend service is experiencing interruptions. Ensure you can handle downtime appropriately by wrapping the method with a pcall.
An array of userIds requested.
An array of dictionary objects that contain the user’s names
The signature of a singular
UserInfoResponse object is:
|number||Id||The Id associated with the UserInfoResponse object|
|string||Username||The username associated with the UserInfoResponse object|
|string||DisplayName||The display name associated with the UserInfoResponse object|