Repository navigation
World Module
The World submodule provides functions to query and modify blocks in the world, inspect player raycast targets (blocks and entities), manipulate weather conditions and cloud height, play sounds, and detect when worlds are joined or left.
| Game.World.OnWorldJoin | Triggered when the player loads and enters a world |
| Game.World.OnWorldLeave | Triggered when the player leaves or exits a world |
Loaded |
boolean |
Read-only. Whether a world is currently loaded |
Raining |
boolean |
Whether rain weather is active |
Thunderstorm |
boolean |
Whether thunderstorm weather is active |
CloudsHeight |
number |
Vertical height offset of cloud rendering |
Weather |
WeatherType | Active weather enum state (WeatherType) |
| Game.World.message | Displays an in-game HUD notification |
| Game.World.getTargetEntity | Returns the entity the player is crosshair-aiming at |
| Game.World.getTargetBlock | Returns block coordinates the player is crosshair-aiming at |
| Game.World.getBlock | Retrieves the block ID and data at coordinates |
| Game.World.setBlock | Places or changes a block at coordinates |
| Game.World.getCurrentBiome | Returns the biome ID of the player's current location |
| Game.World.playGlobalSound | Plays an audio sound effect globally |
Fires as soon as the player finishes loading and enters a Minecraft world.
Game.World.OnWorldJoin:Connect(function()
end)Game.World.OnWorldJoin:Connect(function()
Game.World.message("Welcome back to your world!")
end)Fires when the player saves, leaves, or quits the current world to the main menu.
Game.World.OnWorldLeave:Connect(function()
end)Pushes an in-game message notification banner to the top screen HUD. Returns true if displayed successfully.
Game.World.message(msg: string) -> booleanReturns the GameEntity that the player is looking at, or nil if not looking at an entity.
Game.World.getTargetEntity() -> GameEntity?Returns a table with x, y, z integer coordinates of the block currently targeted by the player's crosshair, or nil if looking at the sky or outside raycast range.
Game.World.getTargetBlock() -> {x: integer, y: integer, z: integer}?local target = Game.World.getTargetBlock()
if target then
local id, data = Game.World.getBlock(target.x, target.y, target.z)
Core.Debug.message(string.format("Looking at block %d:%d at (%d, %d, %d)", id, data, target.x, target.y, target.z))
endReads and returns the block ID and data/variant at the specified (x, y, z) world coordinates.
Game.World.getBlock(x: integer, y: integer, z: integer) -> integer, integerSets the block at the specified (x, y, z) coordinates to blockId with blockData. Automatically scheduled safely on the game's main engine thread.
Game.World.setBlock(x: integer, y: integer, z: integer, blockId: integer, blockData: integer)-- Place a diamond block (ID 57) 2 blocks beneath the player
local px, py, pz = Game.LocalPlayer.Position.get()
Game.World.setBlock(math.floor(px), math.floor(py) - 2, math.floor(pz), 57, 0)Returns the integer biome ID where the local player is currently situated, or -1 if unavailable.
Game.World.getCurrentBiome() -> integerPlays a global sound effect by its string sound ID with volume and pitch settings.
Game.World.playGlobalSound(soundId: string, volume: number, pitch: number)Game.World.playGlobalSound("random.levelup", 1.0, 1.0)