Skip to content

Player Module

The player module allows your scripts to access information about your character, manage your agricultural inventory, and communicate with the user interface.


Use these functions to track your wealth and calculate potential profits.

FunctionReturnsDescription
player.scrap()numberThe amount of “Scrap” (Coins) you currently own.
player.calculateFinalScrap()numberCalculates the total value of your current inventory if sold.
lau-compiler.exe
varol currentCash = player.scrap()
varol potentialCash = player.calculateFinalScrap()
print("Balance: " + currentCash)
print("Total Inventory Value: " + potentialCash)
OUTPUT:
Balance: 5,400 Total Inventory Value: 12,500

Efficient drones check inventory space before harvesting to avoid wasting crops.

FunctionReturnsDescription
player.getInventory()listReturns the entire inventory as a list of items.
player.getInventorySize()numberTotal number of items in the inventory.
player.getFruitCount()numberCurrent number of fruits/crops held.
player.getFruitCapacity()numberMaximum number of fruits you can carry.
player.getItem(index)tableReturns details for the item at a specific slot.
player.getEquippedItem()stringThe name of the item currently in your hand.
if player.getFruitCount() >= player.getFruitCapacity() then
player.alert("Inventory Full! Returning to market.")
-- Move to selling station logic here
end

  • player.sent(message): Sends a standard white notification at the top of the screen.
  • player.alert(message): Sends a red system alert for critical warnings.

FunctionReturnsDescription
player.getCurrentTile()number, numberReturns the X,Z of the tile the player is standing on.
player.getTileNumber()numberReturns the total number of hardware upgrade level? (land size).
player.controlEnabled()nilIf I am being honest I have no clue what this does.
player.camera(Enum.Camera.xxxx)No ReturnChange your camera; Base, Drone, Player, World.
player.cameraMode(Enum.CameraMode)No RerturnChange your camera mode; Stable, Follow, Fixed, Classic, Attach.

Triggered whenever the player types a message.

player.chatted:connect(func(msg)
if msg == "start" then
player.sent("Automation sequence initiated.")
autoFarm = true -- Tip, add a `while autoFarm do` so you can start and stop it when typing
elseif msg == "stop" then
autoFarm = false
end
end)

Triggered when a key is pressed. Returns an Enum.KeyCode.

player.input:connect(func(key)
if key == Enum.KeyCode.E then
player.sent("E key pressed!")
end
end)