Get platform user information||doc136875

September 20, 2022

Format

Player:GetUserData(callback) 
  • The class of the functionPlayer

Description

Get the platform user information of the player object. If you want to obtain user information through the platform user ID, please useUserInfoCache.GetCache and UserInfoCache.LoadCacheByUserIdsfunction.

    Callback parameters

    Parameter name Type Description
    NickName string User nick name
    UserID int User platform id
    ProfilePhoto string User icon url
    Language string User Language
    Online bool User is online
    CurrentGame string User current game

    Code example

    On the server side of the player entity templatemount script, get and print player platform user information

    this:GetUserData(function(data)
        for k,v in pairs(data) do
            print(k,v)
        end
    end)