Player Module
The player module allows your scripts to access information about your character, manage your agricultural inventory, and communicate with the user interface.
💰 Economy & Stats
Section titled “💰 Economy & Stats”Use these functions to track your wealth and calculate potential profits.
| Function | Returns | Description |
|---|---|---|
player.scrap() | number | The amount of “Scrap” (Coins) you currently own. |
player.calculateFinalScrap() | number | Calculates 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
🎒 Inventory Management
Section titled “🎒 Inventory Management”Efficient drones check inventory space before harvesting to avoid wasting crops.
| Function | Returns | Description |
|---|---|---|
player.getInventory() | list | Returns the entire inventory as a list of items. |
player.getInventorySize() | number | Total number of items in the inventory. |
player.getFruitCount() | number | Current number of fruits/crops held. |
player.getFruitCapacity() | number | Maximum number of fruits you can carry. |
player.getItem(index) | table | Returns details for the item at a specific slot. |
player.getEquippedItem() | string | The name of the item currently in your hand. |
Example: Full Inventory Check
Section titled “Example: Full Inventory Check”if player.getFruitCount() >= player.getFruitCapacity() then player.alert("Inventory Full! Returning to market.") -- Move to selling station logic hereend📢 UI & Notifications
Section titled “📢 UI & Notifications”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.
🌍 World & Camera
Section titled “🌍 World & Camera”| Function | Returns | Description |
|---|---|---|
player.getCurrentTile() | number, number | Returns the X,Z of the tile the player is standing on. |
player.getTileNumber() | number | Returns the total number of hardware upgrade level? (land size). |
player.controlEnabled() | nil | If I am being honest I have no clue what this does. |
player.camera(Enum.Camera.xxxx) | No Return | Change your camera; Base, Drone, Player, World. |
player.cameraMode(Enum.CameraMode) | No Rerturn | Change your camera mode; Stable, Follow, Fixed, Classic, Attach. |
⌨️ Events
Section titled “⌨️ Events”player.chatted
Section titled “player.chatted”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 endend)player.input
Section titled “player.input”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!") endend)