Engine.GetLocalPlayer

From GTA Connected
Jump to navigation Jump to search

This function returns the local player instance.

Syntax

Engine.GetLocalPlayer()

Return value

This function returns this values:

  • playerInstance - Whenever the player instance exists.
  • nil - Whenever the player doesn't exist.

Example

In this example, we teleport the local player to the origin of the world.

local localPlayer = Engine.GetLocalPlayer()
localPlayer:SetPosition(0.0,0.0,0.0)