get players||doc135772

September 20, 2022

Format

 Game.GetPlayerByUserId(userId) 
  • The class to which the function belongs:Game

Description

Find the player instance in the game with the specified player platform id and return it, or nil if it doesn't exist.


Precautions

If this function is called by the client, it will only get some data of the player


Parameters

Variable name type Description
userId int player platform id


Value Returned

type Description
Player player instance


Code Samples

Get the player instance whose player platform id is 666

local player = Game.GetPlayerByUserId(666)