GetLocalPlayer()
GetLocalPlayer():
Player | null
Description
The GetLocalPlayer
function returns the local player. If the local player does not exist, the function returns null
.
Returned
- Player - player object representing the local player.
null
- if local player is not exists.
Example
ts
let exampleScript: ScriptDescription = {};
exampleScript.OnScriptLoad = () => {
let myPlayer = EntitySystem.GetLocalPlayer();
if(myPlayer) {
console.log("My name - ", myPlayer.GetName());
} else {
console.log("Local player not found");
}
}
RegisterScript(exampleScript, "Example script");