Lua VM Docs

Complete API reference for the Onyx Lua VM — a Lua 5.1 execution environment that runs externally, bridging into Roblox through memory reads. No injection, no internal hooks, fully external.

Overview

The Onyx Lua VM is a standalone Lua 5.1 interpreter compiled into OnyxCore. It reads Roblox process memory externally to emulate the Roblox Lua API — game services, instances, properties, datatypes — without ever injecting code into the target process.

Scripts execute inside OnyxCore's own process space. Instance access, property reads, and service lookups all happen through external RPM calls. This means the VM leaves zero traces inside the Roblox process.

How It Works

When you execute a script through the Onyx UI, it gets compiled and run inside the embedded Lua 5.1 state. The VM provides 160+ registered globals that mirror the standard Roblox scripting API. Instance objects returned by the VM are proxy tables backed by live memory addresses — accessing a property triggers an external memory read from the Roblox process at the correct struct offset.

-- This reads Roblox memory externally, no injection
local players = game:GetService("Players")
for _, p in ipairs(players:GetPlayers()) do
    local char = p.Character
    if char then
        local hrp = char:FindFirstChild("HumanoidRootPart")
        if hrp then print(p.Name, hrp.Position) end
    end
end

Quick Start

Open the Onyx UI, make sure OnyxCore is attached to a running Roblox game, then paste a script into the Executor tab and press Execute. The output panel shows print/warn results. Scripts persist across tabs — use the tab system to organize multiple scripts.

-- Basic example: teleport local player
local lp = game:GetService("Players").LocalPlayer
local hrp = lp.Character:FindFirstChild("HumanoidRootPart")
if hrp then
    hrp.CFrame = CFrame.new(0, 100, 0)
end

Environment Globals

Core environment functions available in every script.

Global
game / Game
Reference to the DataModel root. Use game:GetService("ServiceName") to access services.
→ Instance
Global
workspace / Workspace
Direct reference to the Workspace service.
→ Instance
Global
identifyexecutor()
Returns the executor name and version.
→ string, string ("Onyx", "1.0")
Global
gethwid()
Returns the machine's hardware ID.
→ string
Global
getrbxversion()
Returns the detected Roblox client version string.
→ string
Global
getgamename()
Returns the name of the currently attached Roblox game.
→ string
Global
isrbxactive()
Returns true if the Roblox window is currently focused.
→ boolean
Global
typeof(value)
Returns the Roblox type name of a value. Detects Vector3, Vector2, CFrame, Color3, Instance, and standard Lua types.
typeof(Vector3.new(1,2,3)) → "Vector3"
→ string
Global
tick()
Returns the current Unix timestamp as a high-resolution number.
→ number
Global
wait(seconds?)
Yields the current thread for the given duration (default 0.03s). Returns elapsed time.
wait(1)
→ number
Global
spawn(func)
Schedules a function to run on a new coroutine.
Global
require(instance)
Loads and returns a ModuleScript by instance reference.
→ any
Global
loadstring(source, chunkname?)
Compiles a Lua source string and returns it as a callable function.
→ function | nil, string
Global
getfenv(level?) / setfenv(level, table)
Gets or sets the environment table of a function or stack level.
Global
gcinfo() / newproxy(hasMeta?) / rawlen(table)
Standard Lua compatibility functions. gcinfo returns memory usage in KB, newproxy creates a userdata, rawlen returns raw table length.

Output

Functions for printing to the Onyx output panel.

Global
print(...)
Prints arguments to the output panel. Multiple args are separated by tabs.
Global
warn(...)
Prints a warning message (yellow) to the output panel.
Global
error(message, level?)
Throws a Lua error with the given message.
Global
printl(message) / errorl(message)
Logs to the internal OnyxCore log file instead of the UI output panel.
Global
notify(title, body, duration?)
Shows a toast notification in the Onyx UI overlay.
notify("Hello", "Script loaded!", 5)

Script Analysis

Tools for inspecting and decompiling scripts in the game.

Global
getscripts()
Returns a list of all Script, LocalScript, and ModuleScript instances in the DataModel.
→ table<Instance>
Global
getscriptbytecode(instance)
Returns the raw compiled bytecode of a script instance.
→ string
Global
getscripthash(instance)
Returns a SHA-256 hash of the script's bytecode.
→ string
Global
decompile(instance)
Decompiles a script and returns a best-effort Lua source reconstruction.
→ string
Global
run_secure(source)
Compiles and executes a Lua string in a protected environment.

Input Simulation

Simulate keyboard and mouse input at the OS level.

Keyboard

Global
keypress(keyCode)
Simulates pressing a key down. Takes a Windows virtual key code.
keypress(0x57) -- W key
Global
keyrelease(keyCode)
Simulates releasing a key.
Global
iskeypressed(keyCode)
Returns whether a key is currently held down.
→ boolean

Mouse

Global
mouse1press() / mouse1release() / mouse1click()
Simulate left mouse button press, release, and full click.
Global
mouse2press() / mouse2release() / mouse2click()
Simulate right mouse button press, release, and full click.
Global
ismouse1pressed() / ismouse2pressed()
Check whether left/right mouse buttons are currently held.
→ boolean
Global
mousemoveabs(x, y)
Move the mouse cursor to absolute screen coordinates.
Global
mousemoverel(dx, dy)
Move the mouse cursor by a relative offset.
Global
mousescroll(clicks)
Simulates mouse wheel scrolling. Positive = up, negative = down.
Global
setrobloxinput(enabled)
Enable or disable forwarding input to the Roblox window.

Memory Access

Low-level memory read/write for advanced use.

Global
getbase()
Returns the base address of the Roblox process module.
→ number
Global
memory_read(address, type)
Reads a value at the given address. Types: "int", "float", "double", "byte", "int64", "string", "pointer".
memory_read(addr, "float")
→ number | string
Global
memory_write(address, type, value)
Writes a value at the given address. Same types as memory_read.
memory_write(addr, "float", 100.0)
Global
getgc() / setgc(addr, field, value) / applygc(addr)
Garbage collector manipulation. getgc returns a list of tracked addresses, setgc modifies fields on a tracked object, applygc writes changes back to process memory.
Global
callgate(target, ...)
Invoke a remote function call through the callgate bridge. Used for triggering game RPCs externally.

Networking

HTTP requests and data encoding.

Global
httpget(url)
Performs an HTTP GET request and returns the response body.
→ string
Global
httppost(url, body, contentType?)
Performs an HTTP POST request. Default content type is application/json.
→ string
Global
base64encode(data) / base64decode(data)
Encode or decode a string using Base64.
→ string
Global
GetPingValue()
Returns the current network latency to the Roblox server in milliseconds.
→ number
Global
httplog(enabled)
Enable or disable HTTP request logging to the HttpLogger widget.

Utility

Clipboard, FFlags, and rendering helpers.

Global
setclipboard(text)
Copies the given string to the system clipboard.
Global
setfflag(name, value) / getfflag(name)
Set or retrieve Roblox Fast Flags by name.
Global
WorldToScreen(position)
Projects a Vector3 world position to 2D screen coordinates using the current camera.
local screenPos, onScreen = WorldToScreen(Vector3.new(0, 10, 0))
→ Vector2, boolean

Type Vector3

3D vector with full operator overloading and method support.

Constructors

ConstructorReturnsDescription
Vector3.new(x?, y?, z?)Vector3Creates a new Vector3. Defaults to 0, 0, 0.
Vector3.zeroVector3Constant (0, 0, 0)
Vector3.oneVector3Constant (1, 1, 1)
Vector3.xAxisVector3Constant (1, 0, 0)
Vector3.yAxisVector3Constant (0, 1, 0)
Vector3.zAxisVector3Constant (0, 0, 1)

Properties

PropertyTypeDescription
XnumberX component
YnumberY component
ZnumberZ component
MagnitudenumberLength of the vector
UnitVector3Normalized direction (length 1)

Methods

MethodReturnsDescription
Abs()Vector3Absolute value of each component
Ceil()Vector3Ceiling of each component
Floor()Vector3Floor of each component
Sign()Vector3Sign (-1, 0, or 1) of each component
Dot(other)numberDot product
Cross(other)Vector3Cross product
Lerp(goal, alpha)Vector3Linear interpolation
Angle(other)numberAngle between vectors in radians
FuzzyEq(other, eps?)booleanApproximate equality (default epsilon 1e-5)
Max(other)Vector3Component-wise maximum
Min(other)Vector3Component-wise minimum

Operators

Supports + - * / (vector-vector and vector-scalar), unary -, and ==.

local a = Vector3.new(1, 2, 3)
local b = Vector3.new(4, 5, 6)
print(a + b)        -- 5, 7, 9
print(a:Dot(b))     -- 32
print(a:Cross(b))   -- -3, 6, -3
print(a.Magnitude)  -- 3.7416...
print(a.Unit)       -- normalized

Type Vector2

2D vector for screen coordinates and UI positioning.

Constructors

ConstructorReturnsDescription
Vector2.new(x?, y?)Vector2Creates a new Vector2. Defaults to 0, 0.
Vector2.zeroVector2Constant (0, 0)
Vector2.oneVector2Constant (1, 1)

Properties

PropertyTypeDescription
XnumberX component
YnumberY component
MagnitudenumberLength of the vector
UnitVector2Normalized direction

Operators

Supports + - * (vector-vector and vector-scalar).

Type CFrame

Coordinate frame — position + 3x3 rotation matrix. The fundamental transform type for 3D positioning.

Constructors

ConstructorArgsDescription
CFrame.new()0Identity CFrame at origin
CFrame.new(x, y, z)3Position only, identity rotation
CFrame.new(x,y,z, qx,qy,qz,qw)7Position + quaternion rotation
CFrame.new(x,y,z, r00..r22)12Position + full rotation matrix
CFrame.identity—Constant identity CFrame
CFrame.Angles(rx, ry, rz)3Rotation from Euler angles (radians)
CFrame.fromOrientation(rx, ry, rz)3Rotation from orientation angles

Properties

PropertyTypeDescription
X, Y, ZnumberPosition components
PositionVector3Position as a Vector3
LookVectorVector3Forward direction (-Z axis of rotation)
RightVectorVector3Right direction (X axis of rotation)
UpVectorVector3Up direction (Y axis of rotation)
R00 — R22numberIndividual rotation matrix components

Methods

MethodReturnsDescription
GetComponents()12 numbersReturns x, y, z, R00..R22
Inverse()CFrameInverse of this CFrame
Lerp(goal, alpha)CFrameLinear interpolation
PointToWorldSpace(v3)Vector3Transform a point from local to world space
PointToObjectSpace(v3)Vector3Transform a point from world to local space
VectorToWorldSpace(v3)Vector3Rotate a direction vector to world space
VectorToObjectSpace(v3)Vector3Rotate a direction vector to local space
ToEulerAnglesXYZ()3 numbersReturns rx, ry, rz in radians
ToOrientation()3 numbersReturns rx, ry, rz orientation angles

Operators

CFrame * CFrame composes transforms. CFrame * Vector3 transforms a point. == compares positions.

local cf = CFrame.new(10, 50, 10) * CFrame.Angles(0, math.rad(45), 0)
print(cf.Position)     -- 10, 50, 10
print(cf.LookVector)   -- forward direction
local rx, ry, rz = cf:ToEulerAnglesXYZ()

Type Color3

RGB color with components in the 0–1 range.

Constructors

ConstructorDescription
Color3.new(r?, g?, b?)Components in 0–1 range
Color3.fromRGB(r, g, b)Components in 0–255 range
Color3.fromHSV(h, s, v)From hue/saturation/value
Color3.fromHex(hex)From hex string ("#FF0000" or "FF0000")

Properties & Methods

NameTypeDescription
R, G, BnumberColor channels (0–1)
Lerp(goal, alpha)Color3Linear interpolation between colors
ToHSV()3 numbersConvert to hue, saturation, value
local red = Color3.fromRGB(255, 0, 0)
local blue = Color3.new(0, 0, 1)
local purple = red:Lerp(blue, 0.5)
print(purple.R, purple.G, purple.B)

Instance Bridge

Instances are proxy tables backed by live memory addresses. Accessing properties triggers external memory reads from the Roblox process. The bridge emulates the Roblox Instance API.

Instance Methods

MethodReturnsDescription
FindFirstChild(name, recursive?)Instance?Find a child by name
FindFirstChildOfClass(className)Instance?Find a child by class name
FindFirstChildWhichIsA(className)Instance?Find a child that inherits from class
WaitForChild(name, timeout?)Instance?Wait for a child to exist
GetChildren()tableReturns all direct children
GetDescendants()tableReturns all descendants recursively
IsA(className)booleanCheck if instance inherits from class
IsDescendantOf(ancestor)booleanCheck ancestry
GetFullName()stringFull path from DataModel root
Destroy()—Removes from parent (local only)
Clone()InstanceShallow copy (local only)
GetAttribute(name)anyGet an attribute value
GetAttributes()tableGet all attributes

Common Properties (all instances)

PropertyTypeDescription
NamestringInstance name
ClassNamestringClass name (read from ClassDescriptor)
ParentInstance?Parent instance
AddressnumberRaw memory address (Onyx-specific)

Services

Access via game:GetService("Name"). Supported services and their special functionality:

Service
Players
Players:GetPlayers() — Returns all Player instances.
Players.LocalPlayer — The local player instance.
Player objects expose: .Character, .Name, .DisplayName, .UserId, .Team, :GetMouse()
Service
Workspace
workspace.CurrentCamera — The active Camera instance.
Camera exposes: .FieldOfView, .ViewportSize, .Position (Vector3), .CFrame (with full rotation)
Service
HttpService
:JSONEncode(table) — Serialize table to JSON string.
:JSONDecode(string) — Parse JSON string to table.
:GenerateGUID(wrapInBraces?) — Generate a random UUID.
Service
RunService / UserInputService
Signal stubs available: .RenderStepped, .Heartbeat, .Stepped, .InputBegan, .InputEnded, .InputChanged

Instance Properties

Properties are read directly from Roblox process memory at known struct offsets.

BasePart

PropertyTypeDescription
PositionVector3World position
CFrameCFrameFull transform with rotation matrix
SizeVector3Part dimensions
VelocityVector3Linear velocity
AssemblyLinearVelocityVector3Assembly physics velocity
ColorColor3Part color
CanCollidebooleanCollision flag
TransparencynumberTransparency value

Humanoid

PropertyTypeDescription
HealthnumberCurrent health
MaxHealthnumberMaximum health
WalkSpeednumberWalk speed
JumpPowernumberJump power

ValueBase Objects

All ValueBase descendants are supported: StringValue, IntValue, NumberValue, BoolValue, ObjectValue, Vector3Value, CFrameValue, Color3Value.

local sv = workspace:FindFirstChild("MyStringValue")
print(sv.Value) -- reads the .Value property

GUI Objects

PropertyTypeApplies To
AbsoluteSizeVector2GuiBase2D descendants
AbsolutePositionVector2GuiBase2D descendants
TextstringTextLabel, TextButton, TextBox

Other

PropertyTypeApplies To
TextureIdstringMeshPart
MeshIdstringMeshPart
JobIdstringDataModel

Drawing Library

Create overlay shapes rendered on top of the game via the Onyx overlay. Objects are rendered on the Electron overlay window through a WebSocket bridge.

local circle = Drawing.new("Circle")
circle.Position = Vector2.new(500, 400)
circle.Radius = 50
circle.Color = Color3.fromRGB(255, 0, 0)
circle.Filled = true
circle.Visible = true

Shared Properties (all types)

PropertyTypeDefault
Visiblebooleanfalse
ColorColor3white
Transparencynumber0
ZIndexnumber0
PositionVector2(0, 0)

Line

PropertyTypeDefault
FromVector2(0, 0)
ToVector2(100, 100)
Thicknessnumber1

Circle

PropertyTypeDefault
Radiusnumber50
NumSidesnumber64
Thicknessnumber1
Filledbooleanfalse

Square

PropertyTypeDefault
SizeVector2(100, 100)
Filledbooleanfalse
Cornernumber0

Triangle

PropertyTypeDefault
PointAVector2(0, 0)
PointBVector2(50, 100)
PointCVector2(100, 0)
Filledbooleanfalse

Text

PropertyTypeDefault
Textstring""
Fontnumber0 (UI)
FontSizenumber16
Centerbooleanfalse
Outlinebooleanfalse

Image

PropertyTypeDefault
Datastring""
SizeVector2(50, 50)
Roundingnumber0

Drawing.Fonts

NameValue
Drawing.Fonts.UI0
Drawing.Fonts.System1
Drawing.Fonts.SystemBold2
Drawing.Fonts.Minecraft3
Drawing.Fonts.Monospace4
Drawing.Fonts.Pixel5
Drawing.Fonts.Fortnite6

task Library

Coroutine scheduling utilities matching the Roblox task library.

Method
task.spawn(func, ...)
Immediately run a function on a new coroutine.
Method
task.defer(func, ...)
Schedule a function to run after the current thread yields.
Method
task.delay(seconds, func, ...)
Schedule a function to run after a delay.
Method
task.wait(seconds?)
Yield the current thread. Equivalent to the global wait().
→ number (elapsed time)