Repository navigation
LocalPlayer Module
STBrian edited this page Nov 9, 2026
·
2 revisions
The LocalPlayer submodule provides full control and access to the local player entity: coordinates, velocity, camera angles, physical status, health, hunger, gamemode, dimension, and inventory.
| Position | Manages player 3D coordinates and placement |
| Velocity | Manages player physics velocity and momentum |
| Camera | Manages camera viewing angles and field-of-view |
| Inventory | Manages player inventory slots and equipment |
| InventorySlot | Represents an inventory or armor equipment slot |
Loaded |
boolean |
Read-only. Returns true if the local player is currently loaded in the world |
Dimension |
integer |
Read-only. The current dimension ID (0 = Overworld, 1 = Nether, 2 = The End) |
OnGround |
boolean |
Whether the player is currently grounded on a solid surface |
Sneaking |
boolean |
Whether the player is crouching/sneaking |
Jumping |
boolean |
Whether the player is jumping |
Sprinting |
boolean |
Whether the player is currently sprinting |
Flying |
boolean |
Whether the player is currently in flying mode |
CanFly |
boolean |
Whether flight is enabled for the player |
UnderWater |
boolean |
Whether the player is currently submerged in water |
TouchingWall |
boolean |
Whether the player is in contact with a wall |
Invincible |
boolean |
God mode / invulnerability flag |
CanConsumeItems |
boolean |
Whether the player is permitted to consume items |
BaseMoveSpeed |
number |
Player base movement speed |
MoveSpeed |
number |
Active movement speed modifier |
SwimSpeed |
number |
Swimming speed in water |
FlySpeed |
number |
Flight speed modifier |
CurrentHP |
number |
Current health points (typically 0.0 - 20.0) |
MaxHP |
number |
Maximum health points |
CurrentHunger |
number |
Current hunger bar value (0.0 - 20.0) |
MaxHunger |
number |
Maximum hunger bar capacity |
CurrentLevel |
number |
Experience level number |
LevelProgress |
number |
Experience bar progress (0.0 to 1.0) |
Gamemode |
integer |
Current gamemode (0 = Survival, 1 = Creative, 2 = Adventure) |
ReachDistance |
number |
Block reaching distance for placing and breaking |
SprintDelay |
number |
Delay timer between sprints |
| Game.LocalPlayer.getState | Checks if a synched entity state flag is active on the player |
Checks if the local player currently has an EntityState flag active (e.g. Enums.EntityState.Burning, Enums.EntityState.Gliding, etc.).
Game.LocalPlayer.getState(stateId: EntityState) -> booleanif Game.LocalPlayer.getState(Enums.EntityState.Burning) then
Core.Debug.message("Player is on fire!")
endManages player 3D world coordinates.
Game.LocalPlayer.Position.get() |
Returns x, y, z coordinates |
Game.LocalPlayer.Position.set(x, y, z) |
Sets player position to x, y, z
|
Game.LocalPlayer.Position.add(x, y, z) |
Offsets player position by x, y, z
|
local x, y, z = Game.LocalPlayer.Position.get()
-- Teleport 5 blocks upwards
Game.LocalPlayer.Position.set(x, y + 5, z)Manages player physics velocity vectors.
Game.LocalPlayer.Velocity.get() |
Returns velocity vx, vy, vz
|
Game.LocalPlayer.Velocity.set(vx, vy, vz) |
Sets player velocity vector |
Game.LocalPlayer.Velocity.add(vx, vy, vz) |
Adds acceleration vector to current velocity |
-- Super jump forward
Game.LocalPlayer.Velocity.set(0.0, 1.2, 0.5)Manages player viewing angles and field of view.
FOV |
number |
Current camera field-of-view |
Yaw |
number |
Camera horizontal rotation angle |
Pitch |
number |
Camera vertical angle (look up / down) |
-- Zoom in
Game.LocalPlayer.Camera.FOV = 30.0Provides access to player hotbar, main inventory slots, and equipped armor slots.
Slots |
table<integer|string, InventorySlot> | Main inventory slots, indexed by "hand" or slot index 0 to 36
|
ArmorSlots |
table<integer|string, InventorySlot> | Equipped armor slots, indexed by "helmet", "chestplate", "leggings", "boots", or index 1 to 4
|
-- Inspect item held in hand
local handSlot = Game.LocalPlayer.Inventory.Slots["hand"]
if not handSlot:isEmpty() then
Core.Debug.message("Holding item ID: " .. tostring(handSlot.Item.ID))
Core.Debug.message("Count: " .. tostring(handSlot.ItemCount))
end