Win Lua VM API Documentation
Global 'game' Table
The global `game` table provides access to core game functionalities, objects, and events.
Properties & Objects
Retrieves the main DataModel instance of the game.
Retrieves the Workspace instance.
Retrieves the current Camera instance.
Retrieves the local Player object.
Retrieves the Players service instance.
Retrieves the VisualEngine object.
Retrieves a table (array) of cached Player objects.
Global 'drawing' Table
The global `drawing` table provides functions for 2D rendering on the screen. Coordinates are typically screen-based (top-left is 0,0). Drawings are cleared each frame after rendering.
Returns the current screen dimensions.
Return | Type | Description |
---|---|---|
screenSize | vector2 | A table {x, y} representing screen width and height. |
Draws a line on the screen.
Parameter | Type | Description |
---|---|---|
startPos | vector2 | The starting {x, y} coordinates of the line. |
endPos | vector2 | The ending {x, y} coordinates of the line. |
color | Color | The color of the line. |
thickness? | number | Optional. The thickness of the line. Defaults to 1.0. |
Draws a circle on the screen.
Parameter | Type | Description |
---|---|---|
centerPos | vector2 | The center {x, y} coordinates of the circle. |
radius | number | The radius of the circle. |
color | Color | The color of the circle. |
filled | boolean | If true, the circle is filled; otherwise, it's an outline. |
thickness? | number | Optional. The thickness of the outline if not filled. Defaults to 1.0. |
segments? | integer | Optional. The number of segments to use for drawing the circle. 0 for auto. Defaults to 0. |
Draws a rectangle on the screen.
Parameter | Type | Description |
---|---|---|
topLeftPos | vector2 | The top-left {x, y} coordinates of the rectangle. |
size | vector2 | The {width, height} of the rectangle. |
color | Color | The color of the rectangle. |
filled | boolean | If true, the rectangle is filled; otherwise, it's an outline. |
thickness? | number | Optional. The thickness of the outline if not filled. Defaults to 1.0. |
rounding? | number | Optional. The corner rounding radius. Defaults to 0.0. |
Draws text on the screen. Note: `fontSize` effect depends on underlying font rendering capabilities.
Parameter | Type | Description |
---|---|---|
position | vector2 | The top-left {x, y} coordinates for the text. |
text | string | The string to draw. |
color | Color | The color of the text. |
fontSize? | number | Optional. Desired font size. Effect may be limited with default ImGui font handling. Defaults to 0 (uses current/default font size). |
Type: Instance
Represents a generic Roblox object in the game hierarchy. Corresponds to `win_v4::rbx::instance`.
Returns the name of the instance.
Returns the class name of the instance.
Returns a table (array) of the instance's direct children.
Returns a table (array) of all descendants of the instance.
Finds the first child with the given name.
Finds the first child whose name contains the given string.
Finds the first child that is of the given class name.
Returns the parent of the instance.
Returns the Primitive object associated with this instance, if applicable (e.g., for Parts).
Gets a service by name (typically called on DataModel or similar top-level instances).
Gets the camera position (likely if this instance is a Camera or related to it).
Sets the world space position of the camera.
Sets the camera rotation matrix.
Sets the camera's look vector.
Sets the walkspeed (likely for a Humanoid instance).
Gets the team instance (likely for a Player or objects associated with teams).
Gets the health (likely for a Humanoid or Player model).
Gets the maximum health (likely for a Humanoid or Player model).
Gets the UI position of a GUI element.
Sets the UI position of a GUI element.
Gets the UI size of a GUI element.
Gets the absolute screen position of a GUI element.
Gets the local player's character model instance (or player instance, context dependent).
Gets the model instance associated with this instance (e.g., character model from Player instance).
Type: Primitive
Represents a physical part in the game world (e.g., Part, MeshPart). Corresponds to `win_v4::rbx::primitive`.
Returns the world space position of the primitive.
Returns the rotation matrix of the primitive.
Returns the size of the primitive.
Sets the world space position of the primitive.
Smoothly moves the primitive to a target position.
Returns a table containing the size, position, and rotation of the primitive.
Sets the linear velocity of the primitive.
Type: VisualEngine
Represents the game's rendering engine. Corresponds to `win_v4::rbx::visualengine`.
Retrieves the main DataModel instance from the VisualEngine's perspective.
Converts a 3D world position to a 2D screen coordinate.
Return | Type | Description |
---|---|---|
screenPos | vector2 | The (x, y) screen coordinates. |
Type: Player
Represents a player in the game. Corresponds to `win_v4::rbx::player`.
Returns the name of the player.
Returns true if the player's character is R6, false otherwise.
Returns true if the player's character is R15, false otherwise.
Returns true if the player's character is currently visible.
Returns true if this is the local player.
Returns the current health of the player's character.
Returns the maximum health of the player's character.
Returns a table (array) of the player's character model's children.
Returns the Head instance of the player's character.
Returns the HumanoidRootPart instance of the player's character.
Returns the Humanoid instance of the player's character.
Returns the Team instance the player belongs to.
Returns the Player instance from the Players service that corresponds to this player object.
Returns the character model Instance of the player.
Type: Event Objects
Event objects allow you to connect functions to specific occurrences within the VM or game. Example:
game.OnRender
.
Connects a Lua function to be called when the event fires.
Parameter | Type | Description |
---|---|---|
callback | function | The function to execute when the event occurs. It will be called with no arguments. |
Return | Type | Description |
---|---|---|
connection | table | A connection object. Currently, this object contains 'Function' (the callback) and 'Ref' (internal registry reference). A Disconnect method may be added in the future. |
local connection = game.OnRender(function()
print("Render frame!")
end)
Custom Data Types
These are represented as Lua tables with specific fields.
vector2
A 2D vector, used for screen coordinates and UI dimensions.
- x: number - The X component.
- y: number - The Y component.
local point = { x = 100, y = 150 }
vector3
A 3D vector.
- x: number - The X component.
- y: number - The Y component.
- z: number - The Z component.
local pos = { x = 10, y = 20, z = 30 }
matrix3
A 3x3 matrix, represented as a Lua table with 9 numeric elements (1-indexed).
- [1] to [9]: number - The matrix elements in row-major order.
local rot = { 1, 0, 0, 0, 1, 0, 0, 0, 1 } -- Identity matrix
udim2
A 2D data type used for UI sizing and positioning, combining scale and offset.
- XScale: number - X-axis scale component.
- XOffset: number - X-axis offset component (in pixels).
- YScale: number - Y-axis scale component.
- YOffset: number - Y-axis offset component (in pixels).
local uiPos = { XScale = 0.5, XOffset = 10, YScale = 0.1, YOffset = 5 }
Color
Represents an RGBA color. Component values should be between 0 and 255.
- r: integer - Red component (0-255).
- g: integer - Green component (0-255).
- b: integer - Blue component (0-255).
- a: integer - Alpha component (0-255). Defaults to 255 if not provided.
local redColor = { r = 255, g = 0, b = 0 }
local semiTransparentGreen = { r = 0, g = 255, b = 0, a = 128 }
sizeposrot
A table containing size, position, and rotation information for a Primitive.