Skip to content

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.


Weather affects crop growth and drone performance. Use these functions to make your drone “weather-aware.”

FunctionReturnsDescription
game.weather()stringReturns the current weather (e.g., "Rain").
game.weatherDuration()numberReturns the remaining time in seconds for the current weather.

The changedWeather event triggers immediately when the sky changes.

game.changedWeather:connect(func()
player.sent("The weather is now: " + game.weather())
end)

Access data about other players in the same server.

FunctionReturnsDescription
game.players()listReturns a list of tables containing every player’s Display Name, Username, and Scrap balance.
lau-compiler.exe
varol allPlayers = game.players()
print("[Leaderboard]")
for i, data inpairs(allPlayers) do
print(i + ". " + data.Name + ": " + data.scrap)
end
OUTPUT:
[Leaderboard] 1. A1fi_e: 27,139,262 2. namnamnamnamnampro: 1,246,273,642

FunctionReturnsDescription
game.uptime()numberReturns how many seconds the current server has been running.
game.version()stringReturns the current server version (e.g., "v1.2.4").
game.rejoin()voidInstantly 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 seconds
end