Game Module
The game module provides access to global server data and environmental conditions. Use this to synchronize your drone’s behavior with the world around it.
⛅ Environment & Weather
Section titled “⛅ Environment & Weather”Weather affects crop growth and drone performance. Use these functions to make your drone “weather-aware.”
| Function | Returns | Description |
|---|---|---|
game.weather() | string | Returns the current weather (e.g., "Rain"). |
game.weatherDuration() | number | Returns the remaining time in seconds for the current weather. |
Weather Event
Section titled “Weather Event”The changedWeather event triggers immediately when the sky changes.
game.changedWeather:connect(func() player.sent("The weather is now: " + game.weather())end)👥 Multiplayer & Players
Section titled “👥 Multiplayer & Players”Access data about other players in the same server.
| Function | Returns | Description |
|---|---|---|
game.players() | list | Returns a list of tables containing every player’s Display Name, Username, and Scrap balance. |
Example: Scrap Leaderboard
Section titled “Example: Scrap Leaderboard” lau-compiler.exe
varol allPlayers = game.players()
print("[Leaderboard]")for i, data inpairs(allPlayers) do print(i + ". " + data.Name + ": " + data.scrap)endOUTPUT:
[Leaderboard]
1. A1fi_e: 27,139,262
2. namnamnamnamnampro: 1,246,273,642
⚙️ Server & Versioning
Section titled “⚙️ Server & Versioning”| Function | Returns | Description |
|---|---|---|
game.uptime() | number | Returns how many seconds the current server has been running. |
game.version() | string | Returns the current server version (e.g., "v1.2.4"). |
game.rejoin() | void | Instantly kicks you and reconnects you to the game. |
💡 Practical Example: The Rain-Sensing Drone
Section titled “💡 Practical Example: The Rain-Sensing Drone”Build a drone that only plants high-value crops when it is raining to take advantage of growth boosts.
while true do if game.weather() == "Rain" then player.sent("It's raining! Planting Cactus for boost.") drone.plant(Enum.Seed.Cactus) else drone.plant(Enum.Seed.Wheat) end
task.wait(10) -- Check every 10 secondsend