Class
UserService
NotCreatableService
A service that handles queries regarding users on the Roblox platform.
A service that handles queries regarding users on the Roblox platform.
Methods 2#
| GetUserInfosByUserIdsAsync | Returns an array of user information including user name and display name.Yields |
| GetUserFromGlobalUserIdAsync | Returns a User for the given global user ID within the current
experience.Yields |
GetUserInfosByUserIdsAsync(userIds: Array): Array#
Yields
This function lets you request information about users outside of the
current DataModel in bulk. The input and output values are both
arrays.
- The order of the user info objects in the return value's array may not
match the order of the
UserIdssent in the input parameter's array. Use theIdfield of the user info object to identify your input array with the output array. - It's possible to receive fewer user info objects than requested if one
or more of the
UserIdsin the request array are invalid, such as negative numbers or user IDs that don't have accounts associated with them. It's possible to receive a response with zero results if allUserIdsare invalid. - If a Roblox user does not have a
DisplayNameassociated with their account, this function will instead return the same string as the user's username in their info object'sDisplayNamefield. While a user'sUserIdwill never change, they may change their username or display name, so the same inputUserIdsmay return a different string for these fields from one day to another. - Since
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 this method with aLuaGlobals.pcall(). - Results are limited to 250 per minute, so if you receive an HTTP 429
error, try again later, ideally after reducing the number of
UserIdsin your input array, reducing the number of method calls, or both.
The signature of a singular user info object is:
| Key | Type | Description |
|---|---|---|
Id |
number | The
Class.Player.UserId|UserId associated with the user. |
Username |
string | The username associated with the user. |
DisplayName |
string | The
Class.Player.DisplayName|DisplayName associated with the
user. |
HasVerifiedBadge |
boolean | The
Class.Player.HasVerifiedBadge|HasVerifiedBadge value
associated with the user. |
| Name | Type | Default | Description |
|---|---|---|---|
userIds | Array | An array of UserIds requested. |
Returns
Array— An array of dictionary objects that contain user information.
GetUserFromGlobalUserIdAsync(userId: int64): User#
Yields
Resolves a global user ID to a User for the current experience
domain. Use this when you have a legacy global user ID (for example, one
previously saved in a data store) and need the corresponding
User value.
This is a server-only yielding call.
| Name | Type | Default | Description |
|---|---|---|---|
userId | int64 | The global user ID to resolve. |
Inherited members#
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild